mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
904e10daa7 | ||
|
|
65b6da3f2a | ||
|
|
3f495b72c1 | ||
|
|
90670477c6 | ||
|
|
566ebb503f | ||
|
|
6feab51a5d | ||
|
|
15d0b44ab9 | ||
|
|
a0f20caa77 | ||
|
|
39712ee46e | ||
|
|
dcdbe7bb76 | ||
|
|
01a4255b83 | ||
|
|
d978a24a5e | ||
|
|
ed196f72b9 | ||
|
|
c9fd1dcfd0 | ||
|
|
c1018d9e0f | ||
|
|
cb8a48cdec | ||
|
|
6bf6a5c86a | ||
|
|
790aa07130 | ||
|
|
fa74a4744c | ||
|
|
fb68b03a4f | ||
|
|
75228cc4c8 | ||
|
|
8c13361164 | ||
|
|
d05dc83e67 | ||
|
|
c9f21c4547 | ||
|
|
f053f25397 | ||
|
|
f673708a3f | ||
|
|
aab63adac2 | ||
|
|
6f09a999d2 | ||
|
|
2ed44dab6d | ||
|
|
a8f46453d8 | ||
|
|
baa4a3158f | ||
|
|
8328b93227 | ||
|
|
6665416683 | ||
|
|
cf5e899632 | ||
|
|
51954c6bd4 | ||
|
|
f282c02376 | ||
|
|
e2c75fbd9d | ||
|
|
b28e3ef2fd | ||
|
|
215de5511e | ||
|
|
f669804573 | ||
|
|
9c6423bf99 | ||
|
|
4f3b73c1ac | ||
|
|
8ee53accf9 | ||
|
|
6b646b3857 | ||
|
|
dec1649882 | ||
|
|
6b9c3475a0 | ||
|
|
1335a12065 | ||
|
|
93bd8ca737 | ||
|
|
5bae0c16c5 | ||
|
|
d551cdbb70 | ||
|
|
e711d5786e | ||
|
|
64abb3c582 | ||
|
|
bf26f1b0c0 | ||
|
|
f4f1a99372 | ||
|
|
53f0a5ce2a | ||
|
|
c621a5dddb | ||
|
|
42faf38a47 | ||
|
|
c50a563e80 | ||
|
|
996f63f55f | ||
|
|
fb77b229ea | ||
|
|
886d55057a | ||
|
|
7f645d6bd1 | ||
|
|
f8d59e5fc0 | ||
|
|
78ebbf40f4 | ||
|
|
dccd75113b | ||
|
|
d063655b25 | ||
|
|
5e0844e9ea | ||
|
|
386c3c0fcd | ||
|
|
2857c13e15 | ||
|
|
d14b42c146 | ||
|
|
29988d0d6c | ||
|
|
bc5d72b6fe | ||
|
|
03f9b36ff0 | ||
|
|
afb9f96a1a | ||
|
|
28e685818c | ||
|
|
51eca5c8c0 | ||
|
|
1699fbda6c | ||
|
|
abbe8b9be1 | ||
|
|
10735b8be6 | ||
|
|
e9d8a9d1a6 | ||
|
|
780d30c01f | ||
|
|
d6adb3241c | ||
|
|
3594fc19dc | ||
|
|
883f538709 | ||
|
|
c280fc719b | ||
|
|
7da9e64ab6 | ||
|
|
bba602ab04 | ||
|
|
78dc226d13 | ||
|
|
a2792d502e | ||
|
|
e800a23e1d | ||
|
|
e731b4ec95 | ||
|
|
dde697d3b4 | ||
|
|
c4d4f85ae4 | ||
|
|
84e3666a66 | ||
|
|
c2f11ecfbe | ||
|
|
85d69aa5f0 | ||
|
|
7beb558140 | ||
|
|
49126c506d | ||
|
|
4c57c98e67 | ||
|
|
e464d92164 | ||
|
|
b30fd71e4b | ||
|
|
99ad91306b | ||
|
|
ed96f26cea | ||
|
|
e6f71190ed | ||
|
|
8219feee6d | ||
|
|
bc8a85e046 | ||
|
|
67f62f02e6 | ||
|
|
471c65973b | ||
|
|
5ff7149dc1 | ||
|
|
80988e52cf |
@@ -10,6 +10,7 @@ assignees: ''
|
||||
### Environment
|
||||
- xsystem35 version:
|
||||
- OS:
|
||||
- Game title:
|
||||
|
||||
### Steps to reproduce the behavior
|
||||
1.
|
||||
@@ -22,3 +23,4 @@ assignees: ''
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
|
||||
### Additional context
|
||||
<!-- Note: Please do not post copyrighted game files. -->
|
||||
|
||||
@@ -1,5 +1,35 @@
|
||||
# Changelog
|
||||
|
||||
## 2.15.0 - 2024-04-21
|
||||
- Fixed color palette bug introduced in v2.14.2.
|
||||
- Fixed uncancellable message waiting mode.
|
||||
- Android: "Install from ZIP" button is moved to the top-right option menu.
|
||||
- Android: Improved extraction logic of track numbers from audio file names.
|
||||
|
||||
## 2.14.3 - 2024-04-01
|
||||
- Fixed build for big endian architectures.
|
||||
|
||||
## 2.14.2 - 2024-03-09
|
||||
- Android: Back button to exit the game (#50)
|
||||
- Improved touch input usability in ママトト (#64)
|
||||
|
||||
## 2.14.1 - 2024-02-07
|
||||
- Fixed font selection and text decoration not working in selection menus.
|
||||
- Fixed a graphic issue in DALK intro.
|
||||
|
||||
## 2.14.0 - 2024-01-09
|
||||
- New supported games: 俺の下であがけ and 楽園行.
|
||||
- Windows: On Windows 10 version 1903 or above, now xsystem35 can handle
|
||||
Japanese filenames correctly even if the system locale is not Japanese.
|
||||
|
||||
## 2.13.0 - 2024-12-07
|
||||
- Windows: `Option` -> `Auto Copy Text to Clipboard` menu command has been added.
|
||||
When enabled, in-game text will be copied to the clipboard automatically. This
|
||||
can be used with text hooker tools that support clipboard monitoring.
|
||||
|
||||
## 2.12.1 - 2024-12-02
|
||||
- Windows: Fixed missing DLL error (#60)
|
||||
|
||||
## 2.12.0 - 2024-11-26
|
||||
- Implemented playback of the opening movie for 妻みぐい2.
|
||||
|
||||
|
||||
+15
-6
@@ -10,7 +10,7 @@ set(CMAKE_C_STANDARD 99)
|
||||
enable_testing()
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
||||
|
||||
set(XSYSTEM35_VERSION "2.12.0")
|
||||
set(XSYSTEM35_VERSION "2.15.0")
|
||||
|
||||
include(CheckSymbolExists)
|
||||
include(FetchContent)
|
||||
@@ -37,8 +37,8 @@ endfunction()
|
||||
function(fetch_webp)
|
||||
FetchContent_Declare(
|
||||
libwebp
|
||||
URL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.4.0.tar.gz
|
||||
URL_HASH SHA1=0b1c8bea200caaa010182609dbaaa91aec69b64d
|
||||
URL https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.5.0.tar.gz
|
||||
URL_HASH SHA1=b21aa842136dc59a72a38776a5aa73f4d0b00ac5
|
||||
)
|
||||
set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "Build animation utilities." FORCE)
|
||||
set(WEBP_BUILD_CWEBP OFF CACHE BOOL "Build the cwebp command line tool." FORCE)
|
||||
@@ -143,9 +143,18 @@ else() # non-emscripten, non-android
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_library(PORTMIDI portmidi)
|
||||
if (PORTMIDI)
|
||||
set(HAVE_PORTMIDI 1)
|
||||
if (WIN32)
|
||||
optional_pkg_check_modules(PORTMIDI IMPORTED_TARGET portmidi)
|
||||
if (PORTMIDI_FOUND)
|
||||
set(HAVE_PORTMIDI 1)
|
||||
add_static_library(portmidi_static PORTMIDI)
|
||||
set(PORTMIDI portmidi_static)
|
||||
endif()
|
||||
else ()
|
||||
find_library(PORTMIDI portmidi)
|
||||
if (PORTMIDI)
|
||||
set(HAVE_PORTMIDI 1)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
+37
-37
@@ -1,48 +1,17 @@
|
||||
# xsystem35 for Android
|
||||
|
||||
Minimum supported Android version: 5.0
|
||||
|
||||
## Download
|
||||
You can download prebuilt APKs
|
||||
[here](https://github.com/kichikuou/xsystem35-sdl2/releases).
|
||||
|
||||
## Build
|
||||
Prerequisites:
|
||||
- Android SDK >=28
|
||||
- Android NDK >=r15c
|
||||
|
||||
### Using Android Studio
|
||||
Open this directory as an Android Studio project.
|
||||
|
||||
### Command Line Build
|
||||
Set environment variables and run the `gradlew` script in this directory.
|
||||
|
||||
Example build instructions (for Debian bookworm):
|
||||
```sh
|
||||
# Install necessary packages
|
||||
sudo apt install git wget unzip default-jdk-headless ninja-build
|
||||
|
||||
# Install Android SDK / NDK
|
||||
export ANDROID_SDK_ROOT=$HOME/android-sdk
|
||||
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
|
||||
wget https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip
|
||||
unzip commandlinetools-linux-10406996_latest.zip -d $ANDROID_SDK_ROOT/cmdline-tools
|
||||
mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/tools
|
||||
yes | $ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --licenses
|
||||
$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager ndk-bundle 'cmake;3.22.1'
|
||||
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle
|
||||
|
||||
# Clone and build xsystem35
|
||||
git clone https://github.com/kichikuou/xsystem35-sdl2.git
|
||||
cd xsystem35-sdl2/android
|
||||
./gradlew build # or ./gradlew installDebug if you have a connected device
|
||||
```
|
||||
|
||||
## Usage
|
||||
### Basic Usage
|
||||
1. Create a ZIP file containing all the game files and BGM files (see
|
||||
[below](#preparing-a-zip) for details), and transfer it to your device.
|
||||
2. Open the app. A list of installed games will be displayed. Since no games
|
||||
have been installed yet, only the "Install from ZIP" button will be visible.
|
||||
Tap it.
|
||||
2. Open the app. Tap the option menu (three dots in the top right corner) and
|
||||
select "Install from ZIP".
|
||||
3. Select the ZIP file you created in step 1.
|
||||
4. The game will start. To simulate a right-click, tap the black bars on either
|
||||
the left or right, or top or bottom of the screen.
|
||||
@@ -51,10 +20,12 @@ cd xsystem35-sdl2/android
|
||||
- Include all files from the `GAMEDATA` folder (such as `.ALD` files and
|
||||
others). `.EXE` and `.DLL` files are not necessary, but you can include them
|
||||
if you want.
|
||||
- Music files (`.mp3`, `.ogg`, or `.wav`) whose filenames end with a number
|
||||
will be recognized as BGM files. For example:
|
||||
- Music files (`.mp3`, `.ogg`, or `.wav`) whose filenames have a number either
|
||||
at the beginning or just before the extension are recognized as BGM files.
|
||||
For example:
|
||||
- `Track2.mp3`
|
||||
- `15.ogg`
|
||||
- `02 - Title.mp3`
|
||||
- `rance4_03.wav` (Note: The filename shouldn't be `rance403.wav`, as it
|
||||
would be treated as the 403rd track.)
|
||||
|
||||
@@ -71,3 +42,32 @@ Note: This ZIP format is also compatible with
|
||||
[retroc.net](http://retropc.net/alice/). If you encounter the error message
|
||||
"This type of ZIP is not supported," unzip the file on your PC and re-archive
|
||||
it using modern ZIP creation software.
|
||||
|
||||
## Building from Source
|
||||
|
||||
### Using Android Studio
|
||||
Open this directory as an Android Studio project.
|
||||
|
||||
### Command Line Build
|
||||
Set environment variables and run the `gradlew` script in this directory.
|
||||
|
||||
Example build instructions (for Debian bookworm):
|
||||
```sh
|
||||
# Install necessary packages
|
||||
sudo apt install git wget unzip default-jdk-headless ninja-build
|
||||
|
||||
# Install Android SDK / NDK
|
||||
export ANDROID_SDK_ROOT=$HOME/android-sdk
|
||||
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools
|
||||
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
|
||||
unzip commandlinetools-linux-11076708_latest.zip -d $ANDROID_SDK_ROOT/cmdline-tools
|
||||
mv $ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/tools
|
||||
yes | $ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --licenses
|
||||
$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager ndk-bundle 'cmake;3.22.1'
|
||||
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk-bundle
|
||||
|
||||
# Clone and build xsystem35
|
||||
git clone https://github.com/kichikuou/xsystem35-sdl2.git
|
||||
cd xsystem35-sdl2/android
|
||||
./gradlew build # or ./gradlew installDebug if you have a connected device
|
||||
```
|
||||
|
||||
@@ -14,10 +14,10 @@ android {
|
||||
}
|
||||
compileSdkVersion 34
|
||||
defaultConfig {
|
||||
minSdkVersion 19
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 34
|
||||
versionCode 26
|
||||
versionName "2.12.0" + gitRevision()
|
||||
versionCode 33
|
||||
versionName "2.15.0" + gitRevision()
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DANDROID_APP_PLATFORM=android-19", "-DANDROID_STL=c++_static"
|
||||
|
||||
@@ -7,8 +7,8 @@ set(PROJECT_ROOT_DIR ../../..)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
SDL
|
||||
URL https://github.com/libsdl-org/SDL/releases/download/release-2.30.9/SDL2-2.30.9.tar.gz
|
||||
URL_HASH SHA1=9403df0573d47f62f2de074b582b87576bb4abbc
|
||||
URL https://github.com/libsdl-org/SDL/releases/download/release-2.32.4/SDL2-2.32.4.tar.gz
|
||||
URL_HASH SHA1=4fb68f43891ca4def414cc7cf0f3b2a053cb6aaf
|
||||
)
|
||||
FetchContent_Declare(
|
||||
SDL_ttf
|
||||
|
||||
Vendored
+81
@@ -15,3 +15,84 @@
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLInputConnection {
|
||||
void nativeCommitText(java.lang.String, int);
|
||||
void nativeGenerateScancodeForUnichar(char);
|
||||
}
|
||||
|
||||
-keep,includedescriptorclasses class org.libsdl.app.SDLActivity {
|
||||
# for some reason these aren't compatible with allowoptimization modifier
|
||||
boolean supportsRelativeMouse();
|
||||
void setWindowStyle(boolean);
|
||||
}
|
||||
|
||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLActivity {
|
||||
java.lang.String nativeGetHint(java.lang.String); # Java-side doesn't use this, so it gets minified, but C-side still tries to register it
|
||||
boolean onNativeSoftReturnKey();
|
||||
void onNativeKeyboardFocusLost();
|
||||
boolean isScreenKeyboardShown();
|
||||
android.util.DisplayMetrics getDisplayDPI();
|
||||
java.lang.String clipboardGetText();
|
||||
boolean clipboardHasText();
|
||||
void clipboardSetText(java.lang.String);
|
||||
int createCustomCursor(int[], int, int, int, int);
|
||||
void destroyCustomCursor(int);
|
||||
android.content.Context getContext();
|
||||
boolean getManifestEnvironmentVariables();
|
||||
android.view.Surface getNativeSurface();
|
||||
void initTouch();
|
||||
boolean isAndroidTV();
|
||||
boolean isChromebook();
|
||||
boolean isDeXMode();
|
||||
boolean isTablet();
|
||||
void manualBackButton();
|
||||
int messageboxShowMessageBox(int, java.lang.String, java.lang.String, int[], int[], java.lang.String[], int[]);
|
||||
void minimizeWindow();
|
||||
int openURL(java.lang.String);
|
||||
void requestPermission(java.lang.String, int);
|
||||
int showToast(java.lang.String, int, int, int, int);
|
||||
boolean sendMessage(int, int);
|
||||
boolean setActivityTitle(java.lang.String);
|
||||
boolean setCustomCursor(int);
|
||||
void setOrientation(int, int, boolean, java.lang.String);
|
||||
boolean setRelativeMouseEnabled(boolean);
|
||||
boolean setSystemCursor(int);
|
||||
boolean shouldMinimizeOnFocusLoss();
|
||||
boolean showTextInput(int, int, int, int);
|
||||
}
|
||||
|
||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.HIDDeviceManager {
|
||||
boolean initialize(boolean, boolean);
|
||||
boolean openDevice(int);
|
||||
int sendOutputReport(int, byte[]);
|
||||
int sendFeatureReport(int, byte[]);
|
||||
boolean getFeatureReport(int, byte[]);
|
||||
void closeDevice(int);
|
||||
}
|
||||
|
||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLAudioManager {
|
||||
int[] getAudioOutputDevices();
|
||||
int[] getAudioInputDevices();
|
||||
int[] audioOpen(int, int, int, int, int);
|
||||
void audioWriteFloatBuffer(float[]);
|
||||
void audioWriteShortBuffer(short[]);
|
||||
void audioWriteByteBuffer(byte[]);
|
||||
void audioClose();
|
||||
int[] captureOpen(int, int, int, int, int);
|
||||
int captureReadFloatBuffer(float[], boolean);
|
||||
int captureReadShortBuffer(short[], boolean);
|
||||
int captureReadByteBuffer(byte[], boolean);
|
||||
void captureClose();
|
||||
void audioSetThreadPriority(boolean, int);
|
||||
native int nativeSetupJNI();
|
||||
native void removeAudioDevice(boolean, int);
|
||||
native void addAudioDevice(boolean, int);
|
||||
}
|
||||
|
||||
-keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLControllerManager {
|
||||
void pollInputDevices();
|
||||
void pollHapticDevices();
|
||||
void hapticRun(int, float, int);
|
||||
void hapticStop(int);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
if (!saveDirFound) {
|
||||
File(rootDir, SAVE_DIR).mkdir()
|
||||
}
|
||||
observer?.onGameListChange()
|
||||
}
|
||||
|
||||
private fun createDirForGame(): File {
|
||||
@@ -219,16 +220,17 @@ class Launcher private constructor(private val rootDir: File) {
|
||||
var gameDir: String? = null
|
||||
private set
|
||||
private val aldRegex = """.*?s[a-z]\.ald""".toRegex(RegexOption.IGNORE_CASE)
|
||||
private val audioRegex = """.*?(\d+)\.(wav|mp3|ogg)""".toRegex(RegexOption.IGNORE_CASE)
|
||||
private val audioRegex = """((\d+).*|.*?(\d+))\.(wav|mp3|ogg)""".toRegex(RegexOption.IGNORE_CASE)
|
||||
private val audioFiles: Array<String?> = arrayOfNulls(100)
|
||||
|
||||
fun maybeAdd(path: String) {
|
||||
aldRegex.matchEntire(path)?.let {
|
||||
val name = File(path).name
|
||||
aldRegex.matchEntire(name)?.let {
|
||||
gameDir = File(path).parent
|
||||
ready = true
|
||||
}
|
||||
audioRegex.matchEntire(path)?.let {
|
||||
val track = it.groupValues[1].toInt()
|
||||
audioRegex.matchEntire(name)?.let {
|
||||
val track = it.groupValues[2].toIntOrNull() ?: it.groupValues[3].toInt()
|
||||
if (0 < track && track <= audioFiles.size)
|
||||
audioFiles[track - 1] = path
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.provider.OpenableColumns
|
||||
import android.text.Html
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
@@ -53,6 +54,8 @@ class LauncherActivity : Activity(), LauncherObserver {
|
||||
|
||||
onGameListChange()
|
||||
val listView = findViewById<ListView>(R.id.list)
|
||||
listView.emptyView = findViewById(R.id.empty)
|
||||
findViewById<TextView>(R.id.usage).text = Html.fromHtml(getString(R.string.usage))
|
||||
listView.setOnItemClickListener { _, _, position, _ ->
|
||||
onListItemClick(position)
|
||||
}
|
||||
@@ -75,23 +78,15 @@ class LauncherActivity : Activity(), LauncherObserver {
|
||||
}
|
||||
|
||||
private fun onListItemClick(position: Int) {
|
||||
if (position < launcher.games.size) {
|
||||
startGame(launcher.games[position].path, null)
|
||||
} else {
|
||||
val i = Intent(Intent.ACTION_GET_CONTENT)
|
||||
i.type = CONTENT_TYPE_ZIP
|
||||
startActivityForResult(Intent.createChooser(i, getString(R.string.choose_a_file)), INSTALL_REQUEST)
|
||||
}
|
||||
startGame(launcher.games[position].path, null)
|
||||
}
|
||||
|
||||
private fun onItemLongClick(position: Int): Boolean {
|
||||
if (position < launcher.games.size) {
|
||||
AlertDialog.Builder(this).setTitle(R.string.uninstall_dialog_title)
|
||||
.setMessage(getString(R.string.uninstall_dialog_message, launcher.games[position].title))
|
||||
.setPositiveButton(R.string.ok) {_, _ -> uninstall(position)}
|
||||
.setNegativeButton(R.string.cancel) {_, _ -> }
|
||||
.show()
|
||||
}
|
||||
AlertDialog.Builder(this).setTitle(R.string.uninstall_dialog_title)
|
||||
.setMessage(getString(R.string.uninstall_dialog_message, launcher.games[position].title))
|
||||
.setPositiveButton(R.string.ok) {_, _ -> uninstall(position)}
|
||||
.setNegativeButton(R.string.cancel) {_, _ -> }
|
||||
.show()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -102,6 +97,12 @@ class LauncherActivity : Activity(), LauncherObserver {
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.install_from_zip -> {
|
||||
val i = Intent(Intent.ACTION_GET_CONTENT)
|
||||
i.type = CONTENT_TYPE_ZIP
|
||||
startActivityForResult(Intent.createChooser(i, getString(R.string.choose_a_file)), INSTALL_REQUEST)
|
||||
true
|
||||
}
|
||||
R.id.export_savedata -> {
|
||||
val i = Intent(Intent.ACTION_CREATE_DOCUMENT)
|
||||
i.type = CONTENT_TYPE_ZIP
|
||||
@@ -116,6 +117,12 @@ class LauncherActivity : Activity(), LauncherObserver {
|
||||
SAVEDATA_IMPORT_REQUEST)
|
||||
true
|
||||
}
|
||||
R.id.help -> {
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(Html.fromHtml(getString(R.string.usage)))
|
||||
.show()
|
||||
true
|
||||
}
|
||||
R.id.licenses -> {
|
||||
val intent = Intent(this, LicensesMenuActivity::class.java)
|
||||
startActivity(intent)
|
||||
@@ -157,7 +164,6 @@ class LauncherActivity : Activity(), LauncherObserver {
|
||||
|
||||
override fun onGameListChange() {
|
||||
val items = launcher.titles.toMutableList()
|
||||
items.add(getString(R.string.install_from_zip))
|
||||
val listView = findViewById<ListView>(R.id.list)
|
||||
listView.adapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, items)
|
||||
}
|
||||
|
||||
@@ -60,8 +60,8 @@ import java.util.Locale;
|
||||
public class SDLActivity extends Activity implements View.OnSystemUiVisibilityChangeListener {
|
||||
private static final String TAG = "SDL";
|
||||
private static final int SDL_MAJOR_VERSION = 2;
|
||||
private static final int SDL_MINOR_VERSION = 30;
|
||||
private static final int SDL_MICRO_VERSION = 9;
|
||||
private static final int SDL_MINOR_VERSION = 32;
|
||||
private static final int SDL_MICRO_VERSION = 4;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
@@ -790,6 +790,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
SDLActivity.mFullscreenModeActive = false;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 28 /* Android 9 (Pie) */) {
|
||||
window.getAttributes().layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "error handling message, getContext() returned no Activity");
|
||||
|
||||
@@ -6,4 +6,12 @@
|
||||
<ListView android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<ScrollView android:id="@+id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView android:id="@+id/usage"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="20dp" />
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
@@ -1,11 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/install_from_zip"
|
||||
android:title="@string/action_install_from_zip" />
|
||||
<item
|
||||
android:id="@+id/export_savedata"
|
||||
android:title="@string/action_export_save_data" />
|
||||
<item
|
||||
android:id="@+id/import_savedata"
|
||||
android:title="@string/action_import_save_data" />
|
||||
<item
|
||||
android:id="@+id/help"
|
||||
android:title="@string/action_help" />
|
||||
<item
|
||||
android:id="@+id/licenses"
|
||||
android:title="@string/action_licenses" />
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
<resources>
|
||||
<string name="app_name">xsystem35</string>
|
||||
<string name="action_export_save_data">セーブデータをエクスポート</string>
|
||||
<string name="action_help">使い方</string>
|
||||
<string name="action_import_save_data">セーブデータをインポート</string>
|
||||
<string name="action_install_from_zip">ZIPからインストール</string>
|
||||
<string name="action_licenses">オープンソースライセンス</string>
|
||||
<string name="cancel">キャンセル</string>
|
||||
<string name="cannot_find_ald">System 3.x のファイル (*.ald) が見つかりません。</string>
|
||||
<string name="choose_a_file">ファイルを選択</string>
|
||||
<string name="error_dialog_title">エラー</string>
|
||||
<string name="install_dialog_title">インストール中…</string>
|
||||
<string name="install_from_zip">ZIP からインストール</string>
|
||||
<string name="install_progress">%s を展開中</string>
|
||||
<string name="no_data_to_import">ZIP アーカイブ中に save/ フォルダが見つかりません。</string>
|
||||
<string name="save_data_export_error">セーブデータのエクスポートに失敗しました。</string>
|
||||
@@ -19,4 +20,21 @@
|
||||
<string name="uninstall_dialog_title">確認</string>
|
||||
<string name="unsupported_zip">この形式の ZIP はサポートしていません。</string>
|
||||
<string name="zip_extraction_error">ZIP の展開に失敗しました。</string>
|
||||
<string name="usage">
|
||||
<![CDATA[
|
||||
<h1>ゲームのインストール方法</h1>
|
||||
<p>1. PC上で、ゲームのファイルが入ったZIPを用意します。例えば以下のようなファイルを含めます:</p>
|
||||
<div>
|
||||
・鬼畜王SA.ALD<br>
|
||||
・鬼畜王GA.ALD<br>
|
||||
・鬼畜王GB.ALD<br>
|
||||
・鬼畜王WA.ALD<br>
|
||||
・02.mp3<br>
|
||||
・03.mp3<br>
|
||||
・…<br>
|
||||
</div>
|
||||
<p>2. ZIPファイルを (例えばUSB経由で) PCからデバイスに転送します。</p>
|
||||
<p>3. この画面の右上のメニューボタンをタップして「ZIPからインストール」を選択し、転送したZIPを選びます。</p>
|
||||
]]>
|
||||
</string>
|
||||
</resources>
|
||||
@@ -1,14 +1,15 @@
|
||||
<resources>
|
||||
<string name="app_name">xsystem35</string>
|
||||
<string name="action_export_save_data">Export Save Files</string>
|
||||
<string name="action_help">Help</string>
|
||||
<string name="action_import_save_data">Import Save Files</string>
|
||||
<string name="action_install_from_zip">Install from ZIP</string>
|
||||
<string name="action_licenses">Open source licenses</string>
|
||||
<string name="cancel">Cancel</string>
|
||||
<string name="cannot_find_ald">Cannot find System 3.x game files (*.ald).</string>
|
||||
<string name="choose_a_file">Choose a file</string>
|
||||
<string name="error_dialog_title">Error</string>
|
||||
<string name="install_dialog_title">Installing…</string>
|
||||
<string name="install_from_zip">Install from ZIP</string>
|
||||
<string name="install_progress">Extracting %s</string>
|
||||
<string name="no_data_to_import">No save/ folder in the ZIP archive.</string>
|
||||
<string name="ok">OK</string>
|
||||
@@ -19,4 +20,22 @@
|
||||
<string name="uninstall_dialog_title">Confirm</string>
|
||||
<string name="unsupported_zip">This type of ZIP is not supported.</string>
|
||||
<string name="zip_extraction_error">Failed to extract ZIP.</string>
|
||||
<string name="usage">
|
||||
<![CDATA[
|
||||
<h1>How to install a game</h1>
|
||||
<p>1. On your PC, prepare a ZIP containing the game files. For example, it should contain the following files:</p>
|
||||
<div>
|
||||
* KICHIKUSA.ALD<br>
|
||||
* KICHIKUGA.ALD<br>
|
||||
* KICHIKUGB.ALD<br>
|
||||
* KICHIKUWA.ALD<br>
|
||||
* System39.ain<br>
|
||||
* 02.mp3<br>
|
||||
* 03.mp3<br>
|
||||
* …<br>
|
||||
</div>
|
||||
<p>2. Transfer the ZIP file from your PC to the device (e.g. via USB).</p>
|
||||
<p>3. Tap the menu button at the upper-right of this screen, select "Install from ZIP," and choose the ZIP you transferred.</p>
|
||||
]]>
|
||||
</string>
|
||||
</resources>
|
||||
|
||||
@@ -7,7 +7,7 @@ buildscript {
|
||||
google()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.1.1'
|
||||
classpath 'com.android.tools.build:gradle:8.7.3'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#Thu Nov 11 18:20:34 PST 2021
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+10
-1
@@ -30,7 +30,8 @@ finds System 3.x game files (*.ALD) from the current directory.
|
||||
*-game* _game_::
|
||||
Enables game-specific hacks. Usually auto-detected, but must be specified for
|
||||
games with modified / translated titles. Possible values are: `toushin2`,
|
||||
`rance3_eng`, `rance4_eng`, `rance4_v2`.
|
||||
`rance2`, `rance3`, `rance3_eng`, `rance4_eng`, `rance4_v2`, `persiom`,
|
||||
`agake`.
|
||||
|
||||
*-savedir* _dir_::
|
||||
Directory to save game state files. If _dir_ begins with '~', it is expanded
|
||||
@@ -40,6 +41,14 @@ finds System 3.x game files (*.ALD) from the current directory.
|
||||
The format when writing save files. Possible values are: `xsystem35`,
|
||||
`system36`, `system39` (default).
|
||||
|
||||
*-texthook* _mode_::
|
||||
Set the text hook mode. Possible values are: `none` (default), `print` (print
|
||||
text to console), `copy` (copy text to clipboard).
|
||||
|
||||
*-texthook_suppress* _list_::
|
||||
Suppress text hook on specified scenario pages. _list_ is a comma-separated
|
||||
list of page numbers. Used to suppress system messages, etc.
|
||||
|
||||
*-renderer* _name_::
|
||||
Use the SDL rendering driver named _name_.
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ Game Compatibility
|
||||
| Game | Status | Notes |
|
||||
| ------------------------------------------- | ----------- | ----- |
|
||||
| 鬼畜王ランス | Supported | |
|
||||
| Kichikuou Rance (EN) | Supported | |
|
||||
| Kichikuou Rance (EN) | Supported | Fan translation |
|
||||
| RanceIV -教団の遺産- | Supported | Win95 edition and [Ver2.05](https://hannylaboratory.blogspot.com/2023/01/blog-post_26.html) |
|
||||
| Rance4 -Legacy of the Sect- (EN) | Supported | |
|
||||
| 兰斯IV -教团的遗产- (CN) | Supported | |
|
||||
| Rance4 -Legacy of the Sect- (EN) | Supported | Fan translation |
|
||||
| 兰斯IV -教团的遗产- (CN) | Supported | Fan translation |
|
||||
| ランス4.1 | Supported | [Ver1.05](https://hannylaboratory.blogspot.com/2023/02/blog-post_9.html). Use system3-sdl2 for older versions |
|
||||
| ランス4.2 | Supported | [Ver1.05](https://hannylaboratory.blogspot.com/2023/02/blog-post_9.html). Use system3-sdl2 for older versions |
|
||||
| いけないかつみ先生 | Supported | Emojis are not supported |
|
||||
@@ -52,12 +52,14 @@ Game Compatibility
|
||||
| 妻みぐい | Supported | Opening demo is not supported |
|
||||
| 超昂天使エスカレイヤー | Supported | Opening demo is not supported |
|
||||
| ランス5D | Supported | |
|
||||
| Rance 5D - The Lonely Girl (MangaGamer) | Supported | |
|
||||
| 俺の下であがけ | Unknown | |
|
||||
| 楽園行 | Unknown | |
|
||||
| Rance 5D - The Lonely Girl (EN) | Supported | MangaGamer version |
|
||||
| 俺の下であがけ | Supported | |
|
||||
| 楽園行 | Supported | |
|
||||
| 妻みぐい2 | Supported | |
|
||||
| シェル・クレイル | Supported | |
|
||||
| ナイトデーモン | Supported | |
|
||||
| Nor | Unsupported | |
|
||||
| 翡翠の眸 | Unsupported | |
|
||||
| 学園KING | Supported | From アリスCD |
|
||||
| 学園KING 番外編 | Supported | From アリスCD |
|
||||
| 蒼海に墜ちて | Supported | From アリスCD |
|
||||
|
||||
@@ -16,21 +16,21 @@ static void Init() {
|
||||
|
||||
*var = 1;
|
||||
|
||||
DEBUG_COMMAND_YET("AliceLogo.Init %d,%d,%d,%p:", p1, p2, p3, var);
|
||||
TRACE_UNIMPLEMENTED("AliceLogo.Init %d,%d,%d,%p:", p1, p2, p3, var);
|
||||
}
|
||||
|
||||
static void SetWaveNum() {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("AliceLogo.SetWaveNum %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("AliceLogo.SetWaveNum %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void Run() {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("AliceLogo.Run %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("AliceLogo.Run %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
+6
-19
@@ -5,7 +5,12 @@ add_library(modules STATIC
|
||||
AliceLogo/AliceLogo.c
|
||||
Confirm/Confirm.c
|
||||
Gpx/Gpx.c
|
||||
Gpx/cg.c
|
||||
Gpx/effectcopy.c
|
||||
Gpx/graph_copy_amap.c
|
||||
Gpx/graph_fillrect_amap.c
|
||||
Gpx/graph.c
|
||||
Gpx/surface.c
|
||||
Math/Math.c
|
||||
MsgSkip/MsgSkip.c
|
||||
NIGHTDLL/NIGHTDLL.c
|
||||
@@ -23,6 +28,7 @@ add_library(modules STATIC
|
||||
NIGHTDLL/nt_sound.c
|
||||
NightDemonDemo/NightDemonDemo.c
|
||||
RandMT/RandMT.c
|
||||
S3xMusic/S3xMusic.c
|
||||
SACT/SACT.c
|
||||
SACT/sactcg.c
|
||||
SACT/sactsound.c
|
||||
@@ -60,27 +66,8 @@ add_library(modules STATIC
|
||||
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_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/gre_blend_useamap.c
|
||||
lib/gre_blend.c
|
||||
lib/gre_blend_screen.c
|
||||
nDEMO/nDEMO.c
|
||||
nDEMOE/nDEMOE.c
|
||||
oDEMO/oDEMO.c
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
static void Init() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Confirm.Init %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("Confirm.Init %d:", p1);
|
||||
}
|
||||
|
||||
static void ExistKeyFile() {
|
||||
@@ -20,7 +20,7 @@ static void ExistKeyFile() {
|
||||
|
||||
*var = 1;
|
||||
|
||||
DEBUG_COMMAND_YET("Confirm.ExistKeyFile %s,%p,%p:",p1, p2, var);
|
||||
TRACE_UNIMPLEMENTED("Confirm.ExistKeyFile %s,%p,%p:",p1, p2, var);
|
||||
}
|
||||
|
||||
static void CheckProtectFile() {
|
||||
@@ -30,7 +30,7 @@ static void CheckProtectFile() {
|
||||
|
||||
*var = 1;
|
||||
|
||||
DEBUG_COMMAND_YET("Confirm.CheckProtectFile %s,%p,%p:", p1,p2,var);
|
||||
TRACE_UNIMPLEMENTED("Confirm.CheckProtectFile %s,%p,%p:", p1,p2,var);
|
||||
}
|
||||
|
||||
static void CreateKeyFile() {
|
||||
@@ -40,7 +40,7 @@ static void CreateKeyFile() {
|
||||
|
||||
*var = 1;
|
||||
|
||||
DEBUG_COMMAND_YET("Confirm.CreateKeyFile %s,%p,%p:", p1,p2,var);
|
||||
TRACE_UNIMPLEMENTED("Confirm.CreateKeyFile %s,%p,%p:", p1,p2,var);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
+115
-148
@@ -42,7 +42,7 @@
|
||||
// #include "alpha_plane.h"
|
||||
#include "surface.h"
|
||||
#include "graph.h"
|
||||
// #include "graph2.h"
|
||||
#include "graph_blend_amap.h"
|
||||
|
||||
#include "effectcopy.h"
|
||||
#include "ngraph.h"
|
||||
@@ -68,37 +68,19 @@ static int find_null_surface() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sf_free_one(int no) {
|
||||
surface_t *s;
|
||||
if (no == 0) return NG;
|
||||
|
||||
s = suf[no];
|
||||
if (s == NULL) return NG;
|
||||
|
||||
if (s->pixel) free(s->pixel);
|
||||
if (s->alpha) free(s->alpha);
|
||||
free(s);
|
||||
|
||||
static void sf_free_one(int no) {
|
||||
if (no == 0 || !suf[no]) return;
|
||||
sf_free(suf[no]);
|
||||
suf[no] = NULL;
|
||||
pre_freesurfno = no;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int sf_free_all() {
|
||||
int i;
|
||||
surface_t *s;
|
||||
|
||||
for (i = 1; i < MAX_SURFACE; i++) {
|
||||
if (suf[i] == NULL) continue;
|
||||
s = suf[i];
|
||||
if (s->pixel) free(s->pixel);
|
||||
if (s->alpha) free(s->alpha);
|
||||
free(s);
|
||||
static void sf_free_all() {
|
||||
for (int i = 1; i < MAX_SURFACE; i++) {
|
||||
sf_free(suf[i]);
|
||||
suf[i] = NULL;
|
||||
}
|
||||
|
||||
pre_freesurfno = 1;
|
||||
return OK;
|
||||
}
|
||||
|
||||
static surface_t *sf_get(int no) {
|
||||
@@ -136,7 +118,7 @@ static void Init() {
|
||||
// surface0 を pre_freesurfno として返さないように。
|
||||
pre_freesurfno = 1;
|
||||
|
||||
DEBUG_COMMAND("Gpx.Init %d:", p1);
|
||||
TRACE("Gpx.Init %d:", p1);
|
||||
}
|
||||
|
||||
static void Gpx_reset(void) {
|
||||
@@ -151,18 +133,15 @@ static void Create() {
|
||||
作成に失敗した場合は 0 を返す
|
||||
width : surface の幅
|
||||
height: surface の高さ
|
||||
bpp : surface の深さ(オリジナルでは24bppのみサポート,
|
||||
xsystem35 では display の depth と同じ)
|
||||
bpp : surface の深さ(24bppのみサポート)
|
||||
*/
|
||||
int *var = getCaliVariable();
|
||||
int width = getCaliValue();
|
||||
int height = getCaliValue();
|
||||
int bpp = getCaliValue();
|
||||
surface_t *s;
|
||||
|
||||
//get_surface0();
|
||||
s = sf_create_surface(width, height, sf_get(0)->depth);
|
||||
|
||||
|
||||
surface_t *s = sf_create_surface(width, height);
|
||||
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
@@ -171,7 +150,7 @@ static void Create() {
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.Create %p,%d,%d,%d:", var, width, height, bpp);
|
||||
TRACE("Gpx.Create %p,%d,%d,%d:", var, width, height, bpp);
|
||||
}
|
||||
|
||||
static void CreatePixelOnly() {
|
||||
@@ -187,10 +166,9 @@ static void CreatePixelOnly() {
|
||||
int width = getCaliValue();
|
||||
int height = getCaliValue();
|
||||
int bpp = getCaliValue();
|
||||
surface_t *s;
|
||||
|
||||
s = sf_create_pixel(width, height, sf_get(0)->depth);
|
||||
|
||||
|
||||
surface_t *s = sf_create_pixel(width, height);
|
||||
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
@@ -199,7 +177,7 @@ static void CreatePixelOnly() {
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.CreatePixelOnly %d,%d,%d,%d:", *var, width, height, bpp);
|
||||
TRACE("Gpx.CreatePixelOnly %d,%d,%d,%d:", *var, width, height, bpp);
|
||||
}
|
||||
|
||||
static void CreateAMapOnly() {
|
||||
@@ -225,30 +203,22 @@ static void CreateAMapOnly() {
|
||||
suf[no] = s;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.CreateAMapOnly %p,%d,%d:", var, width, height);
|
||||
TRACE("Gpx.CreateAMapOnly %p,%d,%d:", var, width, height);
|
||||
}
|
||||
|
||||
static void IsSurface() {
|
||||
/*
|
||||
Gpx.IsSurface(): 指定の番号の surface が surface かどうか
|
||||
(pixel と alpha の両方のデータを持つ)を調べる
|
||||
Gpx.IsSurface(): 指定の番号が surface かどうかを調べる
|
||||
|
||||
p1 : surface 番号
|
||||
var : 結果を返す変数。surface ならば 1, !surface ならば 0
|
||||
*/
|
||||
int p1 = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
surface_t *s;
|
||||
|
||||
s = sf_get(p1);
|
||||
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
*var = (s->alpha && s->pixel) ? 1 : 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.IsSurface %d,%p:", p1, var);
|
||||
|
||||
*var = sf_get(p1) ? 1 : 0;
|
||||
|
||||
TRACE("Gpx.IsSurface %d,%p:", p1, var);
|
||||
}
|
||||
|
||||
static void IsPixel() {
|
||||
@@ -267,10 +237,10 @@ static void IsPixel() {
|
||||
if (s == NULL) {
|
||||
*var = 0;
|
||||
} else {
|
||||
*var = s->pixel ? 1 : 0;
|
||||
*var = s->sdl_surface ? 1 : 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.IsPixel %d,%p:", p1, var);
|
||||
TRACE("Gpx.IsPixel %d,%p:", p1, var);
|
||||
}
|
||||
|
||||
static void IsAlpha() {
|
||||
@@ -292,7 +262,7 @@ static void IsAlpha() {
|
||||
*var = s->alpha ? 1 : 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.IsAlpha %d,%p:", p1, var);
|
||||
TRACE("Gpx.IsAlpha %d,%p:", p1, var);
|
||||
}
|
||||
|
||||
static void GetWidth() {
|
||||
@@ -314,7 +284,7 @@ static void GetWidth() {
|
||||
*var = s->width;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.GetWidth %d,%d:", p1, *var);
|
||||
TRACE("Gpx.GetWidth %d,%d:", p1, *var);
|
||||
}
|
||||
|
||||
static void GetHeight() {
|
||||
@@ -336,13 +306,13 @@ static void GetHeight() {
|
||||
*var = s->height;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Gpx.GetHeight %d,%d:", p1, *var);
|
||||
TRACE("Gpx.GetHeight %d,%d:", p1, *var);
|
||||
}
|
||||
|
||||
static void GetCreatedSurface() { /* not used ? */
|
||||
int *var = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.GetCreatedSurface %p:", var);
|
||||
TRACE_UNIMPLEMENTED("Gpx.GetCreatedSurface %p:", var);
|
||||
}
|
||||
|
||||
static void LoadCG() {
|
||||
@@ -357,21 +327,21 @@ static void LoadCG() {
|
||||
|
||||
*var = load_cg_main(p1 -1);
|
||||
|
||||
DEBUG_COMMAND("Gpx.LoadCG %p,%d (%d):", var, p1, *var);
|
||||
TRACE("Gpx.LoadCG %p,%d (%d):", var, p1, *var);
|
||||
}
|
||||
|
||||
static void GetCGPosX() { /* not useed ? */
|
||||
int *var = getCaliVariable();
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.GetCgPosX %p,%d:", var, p1);
|
||||
TRACE_UNIMPLEMENTED("Gpx.GetCgPosX %p,%d:", var, p1);
|
||||
}
|
||||
|
||||
static void GetCGPosY() { /* not useed ? */
|
||||
int *var = getCaliVariable();
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.GetCgPosY %p,%d:", var, p1);
|
||||
TRACE_UNIMPLEMENTED("Gpx.GetCgPosY %p,%d:", var, p1);
|
||||
}
|
||||
|
||||
static void Free() {
|
||||
@@ -382,7 +352,7 @@ static void Free() {
|
||||
*/
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND("Gpx.Free %d:", p1);
|
||||
TRACE("Gpx.Free %d:", p1);
|
||||
|
||||
if (p1 != 0) {
|
||||
sf_free_one(p1);
|
||||
@@ -395,7 +365,7 @@ static void FreeAll() {
|
||||
*/
|
||||
sf_free_all();
|
||||
|
||||
DEBUG_COMMAND("Gpx.FreeAll:");
|
||||
TRACE("Gpx.FreeAll:");
|
||||
}
|
||||
|
||||
static void Copy() {
|
||||
@@ -421,25 +391,29 @@ static void Copy() {
|
||||
int sh = getCaliValue();
|
||||
surface_t *src, *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.Copy %d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss, sx, sy, sw, sh);
|
||||
TRACE("Gpx.Copy %d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss, sx, sy, sw, sh);
|
||||
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
gr_copy(dst, dx, dy, src, sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
static void CopyBright() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
int p5 = getCaliValue();
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
int p9 = getCaliValue();
|
||||
static void CopyBright(void) {
|
||||
int ds = getCaliValue();
|
||||
int dx = getCaliValue();
|
||||
int dy = getCaliValue();
|
||||
int ss = getCaliValue();
|
||||
int sx = getCaliValue();
|
||||
int sy = getCaliValue();
|
||||
int w = getCaliValue();
|
||||
int h = getCaliValue();
|
||||
int lv = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.CopyBright %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
surface_t *dst = sf_get(ds);
|
||||
surface_t *src = sf_get(ss);
|
||||
gr_copy_bright(dst, dx, dy, src, sx, sy, w, h, lv);
|
||||
|
||||
TRACE("Gpx.CopyBright %d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss, sx, sy, w, h, lv);
|
||||
}
|
||||
|
||||
static void CopyAMap() {
|
||||
@@ -465,25 +439,29 @@ static void CopyAMap() {
|
||||
int sh = getCaliValue();
|
||||
surface_t *src, *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.CopyAMap %d,%d,%d,%d,%d,%d,%d,%d:", da, dx, dy, sa, sx, sy, sw, sh);
|
||||
TRACE("Gpx.CopyAMap %d,%d,%d,%d,%d,%d,%d,%d:", da, dx, dy, sa, sx, sy, sw, sh);
|
||||
|
||||
src = sf_get(sa);
|
||||
dst = sf_get(da);
|
||||
gr_copy_alpha_map(dst, dx, dy, src, sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
static void Blend() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
int p5 = getCaliValue();
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
int p9 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.Blend %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
static void Blend(void) {
|
||||
int ds = getCaliValue();
|
||||
int dx = getCaliValue();
|
||||
int dy = getCaliValue();
|
||||
int ss = getCaliValue();
|
||||
int sx = getCaliValue();
|
||||
int sy = getCaliValue();
|
||||
int w = getCaliValue();
|
||||
int h = getCaliValue();
|
||||
int lv = getCaliValue();
|
||||
|
||||
surface_t *dst = sf_get(ds);
|
||||
surface_t *src = sf_get(ss);
|
||||
gr_blend(dst, dx, dy, src, sx, sy, w, h, lv);
|
||||
|
||||
TRACE("Gpx.Blend %d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss, sx, sy, w, h, lv);
|
||||
}
|
||||
|
||||
static void BlendSrcBright() { /* not used ? */
|
||||
@@ -498,7 +476,7 @@ static void BlendSrcBright() { /* not used ? */
|
||||
int p9 = getCaliValue();
|
||||
int p10 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendSrcBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendSrcBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
|
||||
}
|
||||
|
||||
static void BlendAddSatur() { /* not used ? */
|
||||
@@ -511,7 +489,7 @@ static void BlendAddSatur() { /* not used ? */
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAddStatur %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendAddStatur %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
static void BlendAMap() {
|
||||
@@ -537,7 +515,7 @@ static void BlendAMap() {
|
||||
int sh = getCaliValue();
|
||||
surface_t *src, *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.BlendAMap %d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss, sx, sy, sw, sh);
|
||||
TRACE("Gpx.BlendAMap %d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss, sx, sy, sw, sh);
|
||||
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
@@ -554,7 +532,7 @@ static void BlendAMapSrcOnly() { /* not used ? */
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapSrcOnly %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendAMapSrcOnly %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
static void BlendAMapColor() { /* not used ? */
|
||||
@@ -570,7 +548,7 @@ static void BlendAMapColor() { /* not used ? */
|
||||
int p10 = getCaliValue();
|
||||
int p11 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
|
||||
}
|
||||
|
||||
static void BlendAMapColorAlpha() { /* not used ? */
|
||||
@@ -587,7 +565,7 @@ static void BlendAMapColorAlpha() { /* not used ? */
|
||||
int p11 = getCaliValue();
|
||||
int p12 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapColorAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendAMapColorAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
|
||||
}
|
||||
|
||||
static void BlendAMapAlpha() { /* not used ? */
|
||||
@@ -601,7 +579,7 @@ static void BlendAMapAlpha() { /* not used ? */
|
||||
int p8 = getCaliValue();
|
||||
int p9 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendAMapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
|
||||
static void BlendAMapBright() { /* not used ? */
|
||||
@@ -615,7 +593,7 @@ static void BlendAMapBright() { /* not used ? */
|
||||
int p8 = getCaliValue();
|
||||
int p9 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
|
||||
static void BlendAMapAlphaSrcBright() { /* not used ? */
|
||||
@@ -630,7 +608,7 @@ static void BlendAMapAlphaSrcBright() { /* not used ? */
|
||||
int p9 = getCaliValue();
|
||||
int p10 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendAMapBright %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
|
||||
}
|
||||
|
||||
static void BlendUseAMapColor() { /* not used ? */
|
||||
@@ -647,7 +625,7 @@ static void BlendUseAMapColor() { /* not used ? */
|
||||
int p11 = getCaliValue();
|
||||
int p12 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendUseAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendUseAMapColor %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
|
||||
}
|
||||
|
||||
static void BlendScreen() { /* not used ? */
|
||||
@@ -660,7 +638,7 @@ static void BlendScreen() { /* not used ? */
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendScreen %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendScreen %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
static void BlendMultiply() { /* not used ? */
|
||||
@@ -673,7 +651,7 @@ static void BlendMultiply() { /* not used ? */
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendMultiply %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendMultiply %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
static void BlendScreenAlpha() { /* not used ? */
|
||||
@@ -687,7 +665,7 @@ static void BlendScreenAlpha() { /* not used ? */
|
||||
int p8 = getCaliValue();
|
||||
int p9 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.BlendScreenAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
TRACE_UNIMPLEMENTED("Gpx.BlendScreenAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9);
|
||||
}
|
||||
|
||||
static void Fill() {
|
||||
@@ -713,7 +691,7 @@ static void Fill() {
|
||||
int b = getCaliValue();
|
||||
surface_t *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.Fill %d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, r, g, b);
|
||||
TRACE("Gpx.Fill %d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, r, g, b);
|
||||
|
||||
dst = sf_get(ds);
|
||||
gr_fill(dst, dx, dy, dw, dh, r, g, b);
|
||||
@@ -731,21 +709,24 @@ static void FillAlphaColor() { /* not used ? */
|
||||
int lv = getCaliValue();
|
||||
surface_t *dst;
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.FillAlphaColor %d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, r, g, b, lv);
|
||||
TRACE("Gpx.FillAlphaColor %d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, r, g, b, lv);
|
||||
|
||||
dst = sf_get(ds);
|
||||
gr_fill_alpha_color(dst, dx, dy, dw, dh, r, g, b, lv);
|
||||
}
|
||||
|
||||
static void FillAMap() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
int p5 = getCaliValue();
|
||||
int p6 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.FillAMap %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
|
||||
static void FillAMap(void) {
|
||||
int ds = getCaliValue();
|
||||
int x = getCaliValue();
|
||||
int y = getCaliValue();
|
||||
int w = getCaliValue();
|
||||
int h = getCaliValue();
|
||||
int lv = getCaliValue();
|
||||
|
||||
surface_t *dst = sf_get(ds);
|
||||
gr_fill_alpha_map(dst, x, y, w, h, lv);
|
||||
|
||||
TRACE("Gpx.FillAMap %d,%d,%d,%d,%d,%d:", ds, x, y, w, h, lv);
|
||||
}
|
||||
|
||||
static void FillAMapOverBorder() {
|
||||
@@ -770,7 +751,7 @@ static void FillAMapOverBorder() {
|
||||
int d = getCaliValue();
|
||||
surface_t *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.FillAMapOverBorder %d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, s, d);
|
||||
TRACE("Gpx.FillAMapOverBorder %d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, s, d);
|
||||
|
||||
dst = sf_get(ds);
|
||||
gr_fill_alpha_overborder(dst, dx, dy, dw, dh, s, d);
|
||||
@@ -785,7 +766,7 @@ static void FillAMapUnderBorder() { /* not used ? */
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.FillAMapUnderBorder %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
TRACE_UNIMPLEMENTED("Gpx.FillAMapUnderBorder %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static void SaturDP_DPxSA() { /* not used ? */
|
||||
@@ -798,7 +779,7 @@ static void SaturDP_DPxSA() { /* not used ? */
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.SaturDP_DPxSA %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
TRACE_UNIMPLEMENTED("Gpx.SaturDP_DPxSA %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
static void ScreenDA_DAxSA() { /* not used ? */
|
||||
@@ -811,7 +792,7 @@ static void ScreenDA_DAxSA() { /* not used ? */
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.ScreenDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
TRACE_UNIMPLEMENTED("Gpx.ScreenDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
static void AddDA_DAxSA() { /* not used ? */
|
||||
@@ -824,7 +805,7 @@ static void AddDA_DAxSA() { /* not used ? */
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.AddDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
TRACE_UNIMPLEMENTED("Gpx.AddDA_DAxSA %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
static void SpriteCopyAMap() {
|
||||
@@ -852,7 +833,7 @@ static void SpriteCopyAMap() {
|
||||
int cl = getCaliValue();
|
||||
surface_t *src, *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.SpriteCopyAMap %d,%d,%d,%d,%d,%d,%d,%d,%d:", da, dx, dy, sa, sx, sy, sw, sh, cl);
|
||||
TRACE("Gpx.SpriteCopyAMap %d,%d,%d,%d,%d,%d,%d,%d,%d:", da, dx, dy, sa, sx, sy, sw, sh, cl);
|
||||
|
||||
src = sf_get(sa);
|
||||
dst = sf_get(da);
|
||||
@@ -879,7 +860,7 @@ static void BrightDestOnly() {
|
||||
int r = getCaliValue();
|
||||
surface_t *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.BrightDestOnly %d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, r);
|
||||
TRACE("Gpx.BrightDestOnly %d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, r);
|
||||
|
||||
dst = sf_get(ds);
|
||||
|
||||
@@ -900,7 +881,7 @@ static void CopyTextureWrap() { /* not used ? */
|
||||
int p11 = getCaliValue();
|
||||
int p12 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.CopyTextureWrap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
|
||||
TRACE_UNIMPLEMENTED("Gpx.CopyTextureWrap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
|
||||
}
|
||||
|
||||
static void CopyTextureWrapAlpha() { /* not used ? */
|
||||
@@ -918,7 +899,7 @@ static void CopyTextureWrapAlpha() { /* not used ? */
|
||||
int p12 = getCaliValue();
|
||||
int p13 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.CopyTextureWrapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
|
||||
TRACE_UNIMPLEMENTED("Gpx.CopyTextureWrapAlpha %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
|
||||
}
|
||||
|
||||
static void CopyStretch() {
|
||||
@@ -948,7 +929,7 @@ static void CopyStretch() {
|
||||
int sh = getCaliValue();
|
||||
surface_t *src, *dst;
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.CopyStretch %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
|
||||
TRACE("Gpx.CopyStretch %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
|
||||
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
@@ -968,7 +949,7 @@ static void CopyStretchBlend() { /* not used ? */
|
||||
int p10 = getCaliValue();
|
||||
int p11 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.CopyStretchBlend %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
|
||||
TRACE_UNIMPLEMENTED("Gpx.CopyStretchBlend %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
|
||||
}
|
||||
|
||||
static void CopyStretchBlendAMap() {
|
||||
@@ -998,7 +979,7 @@ static void CopyStretchBlendAMap() {
|
||||
int sh = getCaliValue();
|
||||
surface_t *src, *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.CopyStretchBlendAMap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
|
||||
TRACE("Gpx.CopyStretchBlendAMap %d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, dw, dh, ss, sx, sy, sw, sh);
|
||||
|
||||
src = sf_get(ss);
|
||||
dst = sf_get(ds);
|
||||
@@ -1015,7 +996,7 @@ static void StretchBlendScreen2x2() { /* not used ? */
|
||||
int p7 = getCaliValue();
|
||||
int p8 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.StretchBlendScreen2x2 %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
TRACE_UNIMPLEMENTED("Gpx.StretchBlendScreen2x2 %d,%d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7, p8);
|
||||
}
|
||||
|
||||
|
||||
@@ -1049,7 +1030,7 @@ static void StretchBlendScreen2x2WDS() {
|
||||
int sh = getCaliValue();
|
||||
surface_t *src1, *src2, *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.StretchBlendScreen2x2WDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
|
||||
TRACE("Gpx.StretchBlendScreen2x2WDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
|
||||
|
||||
src1 = sf_get(ss1);
|
||||
src2 = sf_get(ss2);
|
||||
@@ -1086,7 +1067,7 @@ static void BlendScreenWDS() {
|
||||
int sh = getCaliValue();
|
||||
surface_t *src1, *src2, *dst;
|
||||
|
||||
DEBUG_COMMAND("Gpx.BlendScreenWDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
|
||||
TRACE("Gpx.BlendScreenWDS %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d:", ds, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh);
|
||||
|
||||
src1 = sf_get(ss1);
|
||||
src2 = sf_get(ss2);
|
||||
@@ -1137,25 +1118,11 @@ static void EffectCopy() {
|
||||
int sh = getCaliValue();
|
||||
int time = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
surface_t *dib, *dst, *src;
|
||||
|
||||
switch(no) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 7:
|
||||
case 11:
|
||||
case 12:
|
||||
case 13:
|
||||
DEBUG_COMMAND("Gpx.EffectCopy %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%p:", no, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh, time, var);
|
||||
break;
|
||||
default:
|
||||
DEBUG_COMMAND_YET("Gpx.EffectCopy %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%p:", no, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh, time, var);
|
||||
}
|
||||
dst = sf_get(ss1);
|
||||
src = sf_get(ss2);
|
||||
|
||||
TRACE("Gpx.EffectCopy %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%p:", no, dx, dy, ss1, sx1, sy1, ss2, sx2, sy2, sw, sh, time, var);
|
||||
|
||||
surface_t *dst = sf_get(ss1);
|
||||
surface_t *src = sf_get(ss2);
|
||||
gpx_effect(no, dx, dy, dst, sx1, sy1, src, sx2, sy2, sw, sh, time, var);
|
||||
|
||||
}
|
||||
@@ -1163,7 +1130,7 @@ static void EffectCopy() {
|
||||
static void SetClickCancelFlag() { /* not used ? */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("Gpx.SetClikCancelFlag %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("Gpx.SetClikCancelFlag %d:", p1);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
@@ -33,9 +33,7 @@
|
||||
#include "ags.h"
|
||||
#include "pms.h"
|
||||
#include "qnt.h"
|
||||
#ifdef HAVE_WEBP
|
||||
#include "webp.h"
|
||||
#endif
|
||||
#include "sdl_core.h"
|
||||
#include "ngraph.h"
|
||||
#include "dri.h"
|
||||
#include "ald_manager.h"
|
||||
@@ -53,10 +51,6 @@ static CG_TYPE check_cgformat(uint8_t *data) {
|
||||
return ALCG_PMS8;
|
||||
} else if (pms64k_checkfmt(data)) {
|
||||
return ALCG_PMS16;
|
||||
#ifdef HAVE_WEBP
|
||||
} else if (webp_checkfmt(data)) {
|
||||
return ALCG_WEBP;
|
||||
#endif
|
||||
}
|
||||
return ALCG_UNKNOWN;
|
||||
}
|
||||
@@ -68,65 +62,38 @@ static CG_TYPE check_cgformat(uint8_t *data) {
|
||||
* @return CG が展開された surface
|
||||
* 未知の形式のときは NULL が返る
|
||||
*/
|
||||
surface_t *sf_getcg(void *b, size_t size) {
|
||||
surface_t *sf = NULL;
|
||||
int type;
|
||||
cgdata *cg = NULL;
|
||||
|
||||
type = check_cgformat(b);
|
||||
switch(type) {
|
||||
static surface_t *sf_getcg(void *b, size_t size) {
|
||||
surface_t *sf;
|
||||
cgdata *cg;
|
||||
|
||||
switch(check_cgformat(b)) {
|
||||
case ALCG_PMS8:
|
||||
// Load as an alpha map
|
||||
cg = pms256_extract(b);
|
||||
cg->alpha = cg->pic;
|
||||
cg->pic = NULL;
|
||||
sf = sf_create_alpha(cg->width, cg->height);
|
||||
sdl_drawImageAlphaMap(cg, sf, 0, 0);
|
||||
break;
|
||||
case ALCG_PMS16:
|
||||
cg = pms64k_extract(b);
|
||||
sf = cg->alpha
|
||||
? sf_create_surface(cg->width, cg->height)
|
||||
: sf_create_pixel(cg->width, cg->height);
|
||||
sdl_drawImage16(cg, sf, 0, 0, 255, false);
|
||||
break;
|
||||
case ALCG_QNT:
|
||||
cg = qnt_extract(b);
|
||||
sf = cg->alpha
|
||||
? sf_create_surface(cg->width, cg->height)
|
||||
: sf_create_pixel(cg->width, cg->height);
|
||||
sdl_drawImage24(cg, sf, 0, 0, 255);
|
||||
break;
|
||||
#ifdef HAVE_WEBP
|
||||
case ALCG_WEBP:
|
||||
cg = webp_extract(b, size);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (cg == NULL) {
|
||||
WARNING("Unknown Cg Type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
case ALCG_PMS8:
|
||||
sf = sf_create_alpha(cg->width, cg->height);
|
||||
gr_draw_amap(sf, cg->x, cg->y, cg->pic, cg->width, cg->height, cg->width);
|
||||
break;
|
||||
|
||||
case ALCG_PMS16:
|
||||
if (cg->alpha) {
|
||||
sf = sf_create_surface(cg->width, cg->height, sf0->depth);
|
||||
gr_drawimage16(sf, cg, cg->x, cg->y);
|
||||
gr_draw_amap(sf, cg->x, cg->y, cg->alpha, cg->width, cg->height, cg->width);
|
||||
} else {
|
||||
sf = sf_create_pixel(cg->width, cg->height, sf0->depth);
|
||||
gr_drawimage16(sf, cg, cg->x, cg->y);
|
||||
}
|
||||
break;
|
||||
|
||||
case ALCG_QNT:
|
||||
case ALCG_WEBP:
|
||||
if (cg->alpha) {
|
||||
sf = sf_create_surface(cg->width, cg->height, sf0->depth);
|
||||
gr_drawimage24(sf, cg, cg->x, cg->y);
|
||||
gr_draw_amap(sf, cg->x, cg->y, cg->alpha, cg->width, cg->height, cg->width);
|
||||
} else {
|
||||
sf = sf_create_pixel(cg->width, cg->height, sf0->depth);
|
||||
gr_drawimage24(sf, cg, cg->x, cg->y);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
cgdata_free(cg);
|
||||
return sf;
|
||||
}
|
||||
@@ -33,7 +33,7 @@ void gpx_effect(int no,
|
||||
struct sdl_effect *eff = sdl_effect_init(&rect, dst, dx, dy, src, sx, sy, type);
|
||||
if (!time)
|
||||
time = (no == SACT_EFFECT_CROSSFADE_DOWN || no == SACT_EFFECT_CROSSFADE_UP) ? 1150 : 2700;
|
||||
ags_runEffect(time, FALSE, (ags_EffectStepFunc)sdl_effect_step, eff);
|
||||
ags_runEffect(time, false, (ags_EffectStepFunc)sdl_effect_step, eff);
|
||||
sdl_effect_finish(eff);
|
||||
|
||||
switch (no) {
|
||||
|
||||
@@ -3,25 +3,15 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "surface.h"
|
||||
#include "graph.h"
|
||||
#include "ngraph.h"
|
||||
#include "nact.h"
|
||||
|
||||
/*
|
||||
gr_xxxx はクリッピングあり
|
||||
gre_xxxx はクリッピングなし
|
||||
*/
|
||||
|
||||
#undef WARNING
|
||||
#define WARNING(...)
|
||||
|
||||
#undef NOTICE
|
||||
#define NOTICE(...)
|
||||
|
||||
#include "ags.h"
|
||||
#include "sdl_core.h"
|
||||
|
||||
/**
|
||||
* surface から surface にコピーなどをする際に、転送元と転送先のsurface
|
||||
@@ -36,80 +26,16 @@
|
||||
* @param ds: 転送先surface
|
||||
* @param dx: 転送先X座標
|
||||
* @param dy: 転送先Y座標
|
||||
* @return TRUE -> 描画領域がある
|
||||
* FALSE-> 転送領域の高さや幅が0以下になったり、転送元、転送先の座標が
|
||||
* @return true -> 描画領域がある
|
||||
* false-> 転送領域の高さや幅が0以下になったり、転送元、転送先の座標が
|
||||
* surfaceの範囲外になり、描画領域がなくなった。
|
||||
* それぞれの引数は適宜変更されている
|
||||
*/
|
||||
boolean gr_clip(surface_t *ss, int *sx, int *sy, int *sw, int *sh, surface_t *ds, int *dx, int *dy) {
|
||||
int w, h;
|
||||
|
||||
if (ss == NULL) {
|
||||
WARNING("ss surface is null");
|
||||
return FALSE;
|
||||
}
|
||||
if (ss == NULL) {
|
||||
WARNING("ss surface is null");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*sx > ss->width) {
|
||||
WARNING("sx is too large (sx=%d,width=%d)", *sx, ss->width);
|
||||
return FALSE;
|
||||
}
|
||||
if (*sy > ss->height) {
|
||||
WARNING("sy is too large (sy=%d,height=%d)", *sy, ss->height);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*sx < 0) {
|
||||
WARNING("sx is too small (sx=%d)", *sx);
|
||||
return FALSE;
|
||||
}
|
||||
if (*sy < 0) {
|
||||
WARNING("sy is too small (sy=%d)", *sy);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*dx > ds->width) {
|
||||
WARNING("dx is too large (dx=%d,width=%d)", *dx, ds->width);
|
||||
return FALSE;
|
||||
}
|
||||
if (*dy > ds->height) {
|
||||
WARNING("dy is too large (dy=%d,height=%d)", *dy, ds->height);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
w = *sw;
|
||||
h = *sh;
|
||||
|
||||
if (*dx < 0) {
|
||||
*sx -= *dx; *sw += *dx; *dx = 0;
|
||||
}
|
||||
if (*dy < 0) {
|
||||
*sy -= *dy; *sh += *dy; *dy = 0;
|
||||
}
|
||||
|
||||
*sw = min(ss->width - *sx, min(ds->width - *dx, *sw));
|
||||
*sh = min(ss->height - *sy, min(ds->height - *dy, *sh));
|
||||
|
||||
if (*sw <= 0) {
|
||||
WARNING("sw become <=0");
|
||||
return FALSE;
|
||||
}
|
||||
if (*sh <= 0) {
|
||||
WARNING("sh become <=0");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*sw != w) {
|
||||
NOTICE("width change %d -> %d", w, *sw);
|
||||
}
|
||||
if (*sh != h) {
|
||||
NOTICE("height change %d -> %d", h, *sh);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
bool gr_clip(surface_t *ss, int *sx, int *sy, int *sw, int *sh, surface_t *ds, int *dx, int *dy) {
|
||||
if (!ss || !ds) return false;
|
||||
MyRectangle src_window = { 0, 0, ss->width, ss->height };
|
||||
MyRectangle dst_window = { 0, 0, ds->width, ds->height };
|
||||
return ags_clipCopyRect(&src_window, &dst_window, sx, sy, dx, dy, sw, sh);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,67 +46,75 @@ boolean gr_clip(surface_t *ss, int *sx, int *sy, int *sw, int *sh, surface_t *ds
|
||||
* @param sy: 描画開始Y座標
|
||||
* @param sw: 描画幅
|
||||
* @param sh: 描画高さ
|
||||
* @return TRUE -> 描画領域がある
|
||||
* FALSE-> 描画領域の高さや幅が0以下になったり、描画開始座標が
|
||||
* @return true -> 描画領域がある
|
||||
* false-> 描画領域の高さや幅が0以下になったり、描画開始座標が
|
||||
* surfaceの範囲外になり、描画領域がなくなった。
|
||||
* それぞれの引数は適宜変更されている
|
||||
*/
|
||||
boolean gr_clip_xywh(surface_t *ss, int *sx, int *sy, int *sw, int *sh) {
|
||||
int w, h;
|
||||
|
||||
if (ss == NULL) {
|
||||
WARNING("ss surface is null");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*sx > ss->width) {
|
||||
WARNING("sx is too large (sx=%d,width=%d)", *sx, ss->width);
|
||||
return FALSE;
|
||||
}
|
||||
if (*sy > ss->height) {
|
||||
WARNING("sy is too large (sy=%d,height=%d)", *sy, ss->height);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
w = *sw;
|
||||
h = *sh;
|
||||
|
||||
if (*sx < 0) {
|
||||
*sw += *sx; *sx = 0;
|
||||
}
|
||||
if (*sy < 0) {
|
||||
*sh += *sy; *sy = 0;
|
||||
}
|
||||
|
||||
*sw = min(ss->width - *sx, *sw);
|
||||
*sh = min(ss->height - *sy, *sh);
|
||||
|
||||
if (*sw <= 0) {
|
||||
WARNING("sw become <=0");
|
||||
return FALSE;
|
||||
}
|
||||
if (*sh <= 0) {
|
||||
WARNING("sh become <=0");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (*sw != w) {
|
||||
NOTICE("width change %d -> %d", w, *sw);
|
||||
}
|
||||
if (*sh != h) {
|
||||
NOTICE("height change %d -> %d", h, *sh);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
bool gr_clip_xywh(surface_t *ss, int *sx, int *sy, int *sw, int *sh) {
|
||||
if (!ss) return false;
|
||||
SDL_Rect rect = {*sx, *sy, *sw, *sh};
|
||||
if (!SDL_IntersectRect(&rect, &(SDL_Rect){ 0, 0, ss->width, ss->height }, &rect))
|
||||
return false;
|
||||
*sx = rect.x;
|
||||
*sy = rect.y;
|
||||
*sw = rect.w;
|
||||
*sh = rect.h;
|
||||
return true;
|
||||
}
|
||||
|
||||
void gr_init() {
|
||||
}
|
||||
|
||||
void gr_copy(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh) {
|
||||
if (!dst->sdl_surface || !src->sdl_surface) return;
|
||||
if (!gr_clip(src, &sx, &sy, &sw, &sh, dst, &dx, &dy)) return;
|
||||
|
||||
SDL_Rect src_rect = {sx, sy, sw, sh};
|
||||
SDL_Rect dst_rect = {dx, dy, sw, sh};
|
||||
if (dst == src) {
|
||||
SDL_Rect r;
|
||||
if (SDL_IntersectRect(&src_rect, &dst_rect, &r)) {
|
||||
SDL_Surface *view = sdl_createSurfaceView(src->sdl_surface, sx, sy, sw, sh);
|
||||
SDL_Surface *tmp = SDL_ConvertSurface(view, dst->sdl_surface->format, 0);
|
||||
src_rect.x = 0;
|
||||
src_rect.y = 0;
|
||||
SDL_LowerBlit(tmp, &src_rect, dst->sdl_surface, &dst_rect);
|
||||
SDL_FreeSurface(tmp);
|
||||
SDL_FreeSurface(view);
|
||||
return;
|
||||
}
|
||||
}
|
||||
SDL_LowerBlit(src->sdl_surface, &src_rect, dst->sdl_surface, &dst_rect);
|
||||
}
|
||||
|
||||
// Copy the specified surface area with brightness lv/255 times
|
||||
void gr_copy_bright(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int width, int height, int lv) {
|
||||
SDL_Rect src_rect = {sx, sy, width, height};
|
||||
SDL_Rect dst_rect = {dx, dy, width, height};
|
||||
SDL_SetSurfaceColorMod(src->sdl_surface, lv, lv, lv);
|
||||
SDL_BlitSurface(src->sdl_surface, &src_rect, dst->sdl_surface, &dst_rect);
|
||||
SDL_SetSurfaceColorMod(src->sdl_surface, 255, 255, 255);
|
||||
}
|
||||
|
||||
void gr_fill(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b) {
|
||||
SDL_Rect rect = {dx, dy, dw, dh};
|
||||
uint32_t color = SDL_MapRGB(dst->sdl_surface->format, r, g, b);
|
||||
SDL_FillRect(dst->sdl_surface, &rect, color);
|
||||
}
|
||||
|
||||
void gr_copy_stretch(surface_t *dst, int dx, int dy, int dw, int dh, surface_t *src, int sx, int sy, int sw, int sh) {
|
||||
SDL_Rect srcrect = {sx, sy, sw, sh};
|
||||
SDL_Rect dstrect = {dx, dy, dw, dh};
|
||||
SDL_BlitScaled(src->sdl_surface, &srcrect, dst->sdl_surface, &dstrect);
|
||||
}
|
||||
|
||||
void gr_blend(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int width, int height, int lv) {
|
||||
|
||||
|
||||
SDL_SetSurfaceBlendMode(src->sdl_surface, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetSurfaceAlphaMod(src->sdl_surface, lv);
|
||||
SDL_BlitSurface(src->sdl_surface, &(SDL_Rect){sx, sy, width, height}, dst->sdl_surface, &(SDL_Rect){dx, dy, width, height});
|
||||
SDL_SetSurfaceAlphaMod(src->sdl_surface, 255);
|
||||
SDL_SetSurfaceBlendMode(src->sdl_surface, SDL_BLENDMODE_NONE);
|
||||
}
|
||||
|
||||
void gr_blend_src_bright(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int width, int height, int alpha, int rate) {
|
||||
@@ -271,56 +205,34 @@ void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int
|
||||
row[x] = xd; xd += a1;
|
||||
}
|
||||
|
||||
switch(dst->depth) {
|
||||
case 16:
|
||||
{
|
||||
uint16_t *yls, *yld;
|
||||
uint8_t *yla;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yls = (uint16_t *)(sp + *(y + col) * src->bytes_per_line);
|
||||
yld = (uint16_t *)(dp + y * dst->bytes_per_line);
|
||||
yla = (uint8_t *)(sa + *(y + col) * src->width);
|
||||
for (x = 0; x < dw; x++) {
|
||||
*(yld + x) = ALPHABLEND16(*(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) = ALPHABLEND16(*(yls+ *(row+x)), *(yld+x), *(yla+*(row+x)));
|
||||
}
|
||||
y++;
|
||||
}
|
||||
for (y = 0; y < dh; y++) {
|
||||
uint32_t *yls = (uint32_t *)(sp + *(y + col) * src->sdl_surface->pitch);
|
||||
uint32_t *yld = (uint32_t *)(dp + y * dst->sdl_surface->pitch);
|
||||
uint8_t *yla = (uint8_t *)(sa + *(y + col) * src->width);
|
||||
for (x = 0; x < dw; x++) {
|
||||
*(yld + x) = ALPHABLEND24(*(yls+ *(row + x)), *(yld+x), *(yla+*(row+x)));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
uint32_t *yls, *yld;
|
||||
uint8_t *yla;
|
||||
|
||||
for (y = 0; y < dh; y++) {
|
||||
yls = (uint32_t *)(sp + *(y + col) * src->bytes_per_line);
|
||||
yld = (uint32_t *)(dp + y * dst->bytes_per_line);
|
||||
yla = (uint8_t *)(sa + *(y + col) * src->width);
|
||||
while (y < dh - 1 && *(col + y) == *(col + y + 1)) {
|
||||
yld += dst->width;
|
||||
for (x = 0; x < dw; x++) {
|
||||
*(yld + x) = ALPHABLEND24(*(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) = ALPHABLEND24(*(yls+ *(row+x)), *(yld+x), *(yla+*(row+x)));
|
||||
}
|
||||
y++;
|
||||
*(yld + x) = ALPHABLEND24(*(yls+ *(row+x)), *(yld+x), *(yla+*(row+x)));
|
||||
}
|
||||
y++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(row);
|
||||
free(col);
|
||||
}
|
||||
|
||||
// Fill the rectangle with the specified color (rgb) and blend rate (lv)
|
||||
void gr_fill_alpha_color(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b, int lv) {
|
||||
SDL_Surface *src = SDL_CreateRGBSurfaceWithFormat(0, dw, dh, 32, SDL_PIXELFORMAT_ARGB8888);
|
||||
SDL_FillRect(src, NULL, SDL_MapRGBA(src->format, r, g, b, lv));
|
||||
SDL_SetSurfaceBlendMode(src, SDL_BLENDMODE_BLEND);
|
||||
SDL_Rect dstrect = {dx, dy, dw, dh};
|
||||
SDL_BlitSurface(src, NULL, dst->sdl_surface, &dstrect);
|
||||
SDL_FreeSurface(src);
|
||||
}
|
||||
|
||||
#include "graph2.c"
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef __GRAPH_H__
|
||||
#define __GRAPH_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "surface.h"
|
||||
|
||||
void gr_init();
|
||||
|
||||
void gr_copy(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh);
|
||||
void gr_copy_bright(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int width, int height, int lv);
|
||||
void gr_fill(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b);
|
||||
void gr_copy_stretch(surface_t *dst, int dx, int dy, int dw, int dh, surface_t *src, int sx, int sy, int sw, int sh);
|
||||
void gr_blend(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int width, int height, int lv);
|
||||
void gr_copy_stretch_blend_alpha_map(surface_t *dst, int dx, int dy, int dw, int dh, surface_t *src, int sx, int sy, int sw, int sh);
|
||||
void gr_fill_alpha_color(surface_t *dst, int dx, int dy, int dw, int dh, int r, int g, int b, int lv);
|
||||
void gr_fill_alpha_overborder(surface_t *dst, int dx, int dy, int dw, int dh, int s, int d);
|
||||
void gr_fill_alpha_underborder(surface_t *dst, int dx, int dy, int dw, int dh, int s, int d);
|
||||
void gr_copy_alpha_map_sprite(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh, int cl);
|
||||
void gr_blend_alpha_wds_stretch2x2(surface_t *src1, int sx1, int sy1, surface_t *src2, int sx2, int sy2, int sw, int sh, surface_t *dst, int dx, int dy);
|
||||
void gr_blend_alpha_wds(surface_t *src1, int sx1, int sy1, surface_t *src2, int sx2, int sy2, int sw, int sh, surface_t *dst, int dx, int dy);
|
||||
|
||||
#endif /* __GRAPH_H__ */
|
||||
|
||||
@@ -75,7 +75,7 @@ void gr_copy_alpha_map_sprite(surface_t *dst, int dx, int dy, surface_t *src, in
|
||||
}
|
||||
|
||||
void gr_blend_alpha_wds_stretch2x2(surface_t *src1, int sx1, int sy1, surface_t *src2, int sx2, int sy2, int sw, int sh, surface_t *dst, int dx, int dy) {
|
||||
surface_t *t = sf_create_surface(sw * 2, sh * 2, dst->depth);
|
||||
surface_t *t = sf_create_surface(sw * 2, sh * 2);
|
||||
|
||||
gr_copy_stretch(t, 0, 0, sw * 2, sh * 2, src2, sx2, sy2, sw, sh);
|
||||
gr_blend_alpha_wds(t, 0, 0, src1, sx1, sy1, sw * 2, sh * 2, dst, dx, dy);
|
||||
@@ -93,45 +93,16 @@ void gr_blend_alpha_wds(surface_t *src1, int sx1, int sy1, surface_t *src2, int
|
||||
sa = GETOFFSET_ALPHA(src1, sx1, sy1);
|
||||
dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
|
||||
switch(dst->depth) {
|
||||
case 16:
|
||||
{
|
||||
uint16_t *yls1, *yls2, *yld;
|
||||
uint8_t *yla;
|
||||
|
||||
for (y = 0; y < sh; y++) {
|
||||
yls1 = (uint16_t *)(sp1 + y * src1->bytes_per_line);
|
||||
yls2 = (uint16_t *)(sp2 + y * src2->bytes_per_line);
|
||||
yld = (uint16_t *)(dp + y * dst->bytes_per_line);
|
||||
yla = (uint8_t *)(sa + y * src1->width);
|
||||
|
||||
for (x = 0; x < sw; x++) {
|
||||
*yld = SUTURADD16(*yls1, ALPHABLEND16(*yls1, *yls2, *yla));
|
||||
//*yld = SUTURADD16(*yls1, ALPHALEVEL16(*yls2, *yla));
|
||||
yls1++; yls2++; yld++; yla++;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
uint32_t *yls1, *yls2, *yld;
|
||||
uint8_t *yla;
|
||||
for (y = 0; y < sh; y++) {
|
||||
uint32_t *yls1 = (uint32_t *)(sp1 + y * src1->sdl_surface->pitch);
|
||||
uint32_t *yls2 = (uint32_t *)(sp2 + y * src2->sdl_surface->pitch);
|
||||
uint32_t *yld = (uint32_t *)(dp + y * dst->sdl_surface->pitch);
|
||||
uint8_t *yla = (uint8_t *)(sa + y * src1->width);
|
||||
|
||||
for (y = 0; y < sh; y++) {
|
||||
yls1 = (uint32_t *)(sp1 + y * src1->bytes_per_line);
|
||||
yls2 = (uint32_t *)(sp2 + y * src2->bytes_per_line);
|
||||
yld = (uint32_t *)(dp + y * dst->bytes_per_line);
|
||||
yla = (uint8_t *)(sa + y * src1->width);
|
||||
|
||||
for (x = 0; x < sw; x++) {
|
||||
*yld = SUTURADD24(*yls1, ALPHABLEND24(*yls1, *yls2, *yla));
|
||||
yls1++; yls2++; yld++; yla++;
|
||||
}
|
||||
for (x = 0; x < sw; x++) {
|
||||
*yld = SUTURADD24(*yls1, ALPHABLEND24(*yls1, *yls2, *yla));
|
||||
yls1++; yls2++; yld++; yla++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,22 +41,22 @@
|
||||
* @param sw: 転送幅
|
||||
* @param sh: 転送高さ
|
||||
*/
|
||||
int gr_copy_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh) {
|
||||
void gr_copy_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh) {
|
||||
uint8_t *sp, *dp;
|
||||
|
||||
if (!gr_clip(src, &sx, &sy, &sw, &sh, dst, &dx, &dy)) return NG;
|
||||
if (!gr_clip(src, &sx, &sy, &sw, &sh, dst, &dx, &dy)) return;
|
||||
|
||||
sp = GETOFFSET_ALPHA(src, sx, sy);
|
||||
dp = GETOFFSET_ALPHA(dst, dx, dy);
|
||||
|
||||
if (sp == NULL) {
|
||||
WARNING("src alpha NULL");
|
||||
return NG;
|
||||
return;
|
||||
}
|
||||
|
||||
if (dp == NULL) {
|
||||
WARNING("dst alpha NULL");
|
||||
return NG;
|
||||
return;
|
||||
}
|
||||
|
||||
if (src == dst) {
|
||||
@@ -82,6 +82,4 @@ int gr_copy_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx, in
|
||||
dp += dst->width;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -6,11 +6,11 @@
|
||||
#include "ngraph.h"
|
||||
#include "ags.h"
|
||||
|
||||
int gr_fill_alpha_map(surface_t *dst, int dx, int dy, int dw, int dh, int lv) {
|
||||
void gr_fill_alpha_map(surface_t *dst, int dx, int dy, int dw, int dh, int lv) {
|
||||
uint8_t *a;
|
||||
|
||||
if (!gr_clip_xywh(dst, &dx, &dy, &dw, &dh)) {
|
||||
return NG;
|
||||
return;
|
||||
}
|
||||
|
||||
a = GETOFFSET_ALPHA(dst, dx, dy);
|
||||
@@ -19,6 +19,4 @@ int gr_fill_alpha_map(surface_t *dst, int dx, int dy, int dw, int dh, int lv) {
|
||||
memset(a, lv, dw);
|
||||
a += dst->width;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef __NGRAPH_H__
|
||||
#define __NGRAPH_H__
|
||||
|
||||
#include "portab.h"
|
||||
#include "nact.h"
|
||||
#include "ags.h"
|
||||
#include "surface.h"
|
||||
#include "graph.h"
|
||||
|
||||
#define sf0 nact->ags.dib
|
||||
|
||||
struct SDL_Surface;
|
||||
|
||||
// DLL 用 graphic 関連関数
|
||||
|
||||
/* in graph.c */
|
||||
bool gr_clip(surface_t *ss, int *sx, int *sy, int *sw, int *sh, surface_t *ds, int *dx, int *dy);
|
||||
bool gr_clip_xywh(surface_t *ss, int *sx, int *sy, int *sw, int *sh);
|
||||
|
||||
/* in graph_fillrect_amap.c */
|
||||
void gr_fill_alpha_map(surface_t *dst, int dx, int dy, int dw, int dh, int lv);
|
||||
|
||||
/* in graph_copy_amap.c */
|
||||
void gr_copy_alpha_map(surface_t *dst, int dx, int dy, surface_t *src, int sx, int sy, int sw, int sh);
|
||||
|
||||
// /* in graph_bright_dst_only.c */
|
||||
#define gr_bright_dst_only(dst,dx,dy,w,h,lv) gr_copy_bright(dst,dx,dy,dst,dx,dy,w,h,lv)
|
||||
// void gr_bright_dst_only(surface_t *dst, int dx, int dy, int w, int h, int lv);
|
||||
|
||||
/* defined in cg.c */
|
||||
surface_t *sf_loadcg_no(int no);
|
||||
|
||||
#endif /* __GRAPH_H__ */
|
||||
@@ -0,0 +1,80 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "surface.h"
|
||||
#include "system.h"
|
||||
|
||||
static surface_t *create(int width, int height, bool has_pixel, bool has_alpha) {
|
||||
surface_t *s = calloc(1, sizeof(surface_t));
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
|
||||
if (has_pixel) {
|
||||
s->sdl_surface = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_RGB888);
|
||||
}
|
||||
|
||||
if (has_alpha) {
|
||||
s->alpha = calloc(width * (height +1), sizeof(uint8_t));
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
// Create a surface with pixel and alpha data
|
||||
surface_t *sf_create_surface(int width, int height) {
|
||||
return create(width, height, true, true);
|
||||
}
|
||||
|
||||
// Create a surface with alpha data only
|
||||
surface_t *sf_create_alpha(int width, int height) {
|
||||
return create(width, height, false, true);
|
||||
}
|
||||
|
||||
// Create a surface with pixel data only
|
||||
surface_t *sf_create_pixel(int width, int height) {
|
||||
return create(width, height, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* surfaceオブジェクトの開放
|
||||
* @param s: 開放するオブジェクト
|
||||
* @return: なし
|
||||
*/
|
||||
void sf_free(surface_t *s) {
|
||||
if (s == NULL) return;
|
||||
if (s->sdl_surface) SDL_FreeSurface(s->sdl_surface);
|
||||
if (s->alpha) free(s->alpha);
|
||||
free(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* surface の複製を作成(dupulicate)
|
||||
* @param in: 複製もと
|
||||
* @return : 複製したsurface
|
||||
*/
|
||||
surface_t *sf_dup(surface_t *in) {
|
||||
surface_t *sf;
|
||||
int len;
|
||||
|
||||
if (in == NULL) return NULL;
|
||||
|
||||
sf = malloc(sizeof(surface_t));
|
||||
memcpy(sf, in, sizeof(surface_t));
|
||||
|
||||
if (in->sdl_surface) {
|
||||
sf->sdl_surface = SDL_ConvertSurface(in->sdl_surface, in->sdl_surface->format, 0);
|
||||
}
|
||||
|
||||
if (in->alpha) {
|
||||
len = sf->width * sf->height;
|
||||
sf->alpha = malloc(sizeof(uint8_t) * (len + sf->width));
|
||||
memcpy(sf->alpha, in->alpha, len);
|
||||
}
|
||||
|
||||
return sf;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef __SURFACE_H__
|
||||
#define __SURFACE_H__
|
||||
|
||||
#include "portab.h"
|
||||
#include "ags.h"
|
||||
|
||||
extern surface_t *sf_create_surface(int width, int height);
|
||||
extern surface_t *sf_create_alpha(int width, int height);
|
||||
extern surface_t *sf_create_pixel(int width, int height);
|
||||
extern void sf_free(surface_t *s);
|
||||
extern surface_t *sf_dup(surface_t *in);
|
||||
|
||||
#endif /* __SURFACE_H__ */
|
||||
+4
-4
@@ -42,7 +42,7 @@ static void RandMTInit() {
|
||||
*/
|
||||
int p1 = getCaliValue(); /* ITimer */
|
||||
|
||||
DEBUG_COMMAND("Math.RandMTInit %d:", p1);
|
||||
TRACE("Math.RandMTInit %d:", p1);
|
||||
}
|
||||
|
||||
static void RandMTGet() {
|
||||
@@ -61,7 +61,7 @@ static void RandMTGet() {
|
||||
*var = (int)(genrand() * num) + 1;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("Math.RandMTGet %d,%p:", num, var);
|
||||
TRACE("Math.RandMTGet %d,%p:", num, var);
|
||||
}
|
||||
|
||||
static void RandMTMakeNumTable() {
|
||||
@@ -74,7 +74,7 @@ static void RandMTMakeNumTable() {
|
||||
|
||||
numtblmax = p1;
|
||||
|
||||
DEBUG_COMMAND("Math.RandMTMakeNumTable %d:", p1);
|
||||
TRACE("Math.RandMTMakeNumTable %d:", p1);
|
||||
}
|
||||
|
||||
static void RandMTGetNumTable() {
|
||||
@@ -87,7 +87,7 @@ static void RandMTGetNumTable() {
|
||||
|
||||
*var = (int)(genrand() * numtblmax) + 1;
|
||||
|
||||
DEBUG_COMMAND("Math.RandMTGetNumTable %d:", *var);
|
||||
TRACE("Math.RandMTGetNumTable %d:", *var);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "msgskip.h"
|
||||
#include "utfsjis.h"
|
||||
|
||||
static boolean valid;
|
||||
static bool valid;
|
||||
static int action;
|
||||
|
||||
static void Init() {
|
||||
@@ -26,7 +26,7 @@ static void Init() {
|
||||
valid = true;
|
||||
*p1 = 0;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.Init %p,%d,%d,%d:", p1, p2, p3, p4);
|
||||
TRACE("MsgSkip.Init %p,%d,%d,%d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void Start() {
|
||||
@@ -39,7 +39,7 @@ static void Start() {
|
||||
free(path);
|
||||
free(fname_utf8);
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.Start %p,%d:", p1, p2);
|
||||
TRACE("MsgSkip.Start %p,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void SetValid() {
|
||||
@@ -48,7 +48,7 @@ static void SetValid() {
|
||||
valid = p1;
|
||||
msgskip_pause(!valid);
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.SetValid %d:", p1);
|
||||
TRACE("MsgSkip.SetValid %d:", p1);
|
||||
}
|
||||
|
||||
static void GetValid() {
|
||||
@@ -56,7 +56,7 @@ static void GetValid() {
|
||||
|
||||
*p1 = valid;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.GetValid %p:", p1);
|
||||
TRACE("MsgSkip.GetValid %p:", p1);
|
||||
}
|
||||
|
||||
static void SetAction() {
|
||||
@@ -64,7 +64,7 @@ static void SetAction() {
|
||||
|
||||
action = p1;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.SetAcion %d:", p1);
|
||||
TRACE("MsgSkip.SetAcion %d:", p1);
|
||||
}
|
||||
|
||||
static void GetAction() {
|
||||
@@ -72,19 +72,19 @@ static void GetAction() {
|
||||
|
||||
*p1 = action;
|
||||
|
||||
DEBUG_COMMAND("MsgSkip.GetAcion %p:", p1);
|
||||
TRACE("MsgSkip.GetAcion %p:", p1);
|
||||
}
|
||||
|
||||
static void PushStr() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.PushStr %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("MsgSkip.PushStr %d:", p1);
|
||||
}
|
||||
|
||||
static void PopStr() {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("MsgSkip.PopStr %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("MsgSkip.PopStr %d:", p1);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
+71
-71
@@ -36,7 +36,7 @@ static void Init(void) { /* 0 */
|
||||
|
||||
*var = 1;
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.Init %p:", var);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.Init %p:", var);
|
||||
}
|
||||
|
||||
static void NIGHTDLL_reset(void) {
|
||||
@@ -51,7 +51,7 @@ static void NIGHTDLL_reset(void) {
|
||||
}
|
||||
|
||||
static void InitGame() { /* 1 */
|
||||
ags_setAntialiasedStringMode(TRUE);
|
||||
ags_setAntialiasedStringMode(true);
|
||||
sys_setHankakuMode(2);
|
||||
|
||||
nact->msgout = ntmsg_add;
|
||||
@@ -62,7 +62,7 @@ static void InitGame() { /* 1 */
|
||||
ntmsg_init();
|
||||
nt_sstr_init();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.InitGame:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.InitGame:");
|
||||
}
|
||||
|
||||
// メッセージの枠の表示
|
||||
@@ -71,7 +71,7 @@ static void SetMsgFrame() { /* 2 */
|
||||
|
||||
ntmsg_set_frame(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgFram %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetMsgFram %d:", p1);
|
||||
}
|
||||
|
||||
// メッセージの表示位置の設定
|
||||
@@ -80,21 +80,21 @@ static void SetMsgPlaceMethod(void) { /* 3 */
|
||||
// 2=メッセージ枠+顔つき
|
||||
ntmsg_set_place(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgPlaceMethod %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetMsgPlaceMethod %d:", p1);
|
||||
}
|
||||
|
||||
// 未実装?
|
||||
static void SetMsgDrawEffect(void) { /* 4 */
|
||||
int p1 = getCaliValue(); // 0, 1, 2, 3 (実際にはどれも機能しない?)
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgDrawEffect %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetMsgDrawEffect %d:", p1);
|
||||
}
|
||||
|
||||
// 未実装?
|
||||
static void SetMsgClearEffect(void) { /* 5 */
|
||||
int p1 = getCaliValue(); // 0, 1, 2, 4 (実際にはどれも機能しない?)
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetMsgClearEffect %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetMsgClearEffect %d:", p1);
|
||||
}
|
||||
|
||||
// 壁紙CGの設定
|
||||
@@ -103,7 +103,7 @@ static void SetWallPaper(void) { /* 6 */
|
||||
|
||||
nt_gr_set_wallpaper(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetWallPaper %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetWallPaper %d:", p1);
|
||||
}
|
||||
|
||||
// 背景CGの設定
|
||||
@@ -112,7 +112,7 @@ static void SetScenery(void) { /* 7 */
|
||||
|
||||
nt_gr_set_scenery(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetScenery %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetScenery %d:", p1);
|
||||
}
|
||||
|
||||
// 顔CGの設定
|
||||
@@ -121,7 +121,7 @@ static void SetFace(void) { /* 8 */
|
||||
|
||||
nt_gr_set_face(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetFace %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetFace %d:", p1);
|
||||
}
|
||||
|
||||
// 立ち絵左の設定
|
||||
@@ -130,7 +130,7 @@ static void SetSpriteL(void) { /* 9 */
|
||||
|
||||
nt_gr_set_spL(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteL %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetSpriteL %d:", p1);
|
||||
}
|
||||
|
||||
// 立ち絵中央の設定
|
||||
@@ -139,7 +139,7 @@ static void SetSpriteM(void) { /* 10 */
|
||||
|
||||
nt_gr_set_spM(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteM %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetSpriteM %d:", p1);
|
||||
}
|
||||
|
||||
// 立ち絵右の設定
|
||||
@@ -148,7 +148,7 @@ static void SetSpriteR(void) { /* 11 */
|
||||
|
||||
nt_gr_set_spR(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteR %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetSpriteR %d:", p1);
|
||||
}
|
||||
|
||||
// 立ち絵左の設定(季節違い?)
|
||||
@@ -157,7 +157,7 @@ static void SetSpriteSeasonL(void) { /* 12 */
|
||||
|
||||
nt_gr_set_spsL(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteSeasonL %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetSpriteSeasonL %d:", p1);
|
||||
}
|
||||
|
||||
// 立ち絵中央の設定(季節違い?)
|
||||
@@ -166,7 +166,7 @@ static void SetSpriteSeasonM(void) { /* 13 */
|
||||
|
||||
nt_gr_set_spM(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteSeasonM %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetSpriteSeasonM %d:", p1);
|
||||
}
|
||||
|
||||
// 立ち絵右の設定(季節違い?)
|
||||
@@ -175,14 +175,14 @@ static void SetSpriteSeasonR(void) { /* 14 */
|
||||
|
||||
nt_gr_set_spsR(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetSpriteSeasonR %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetSpriteSeasonR %d:", p1);
|
||||
}
|
||||
|
||||
// 改行
|
||||
static void StartNewLine(void) { /* 15 */
|
||||
ntmsg_newline();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.StartNewLine:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.StartNewLine:");
|
||||
}
|
||||
|
||||
// メッセージフォントサイズの設定
|
||||
@@ -191,7 +191,7 @@ static void SetFontSize(void) { /* 16 */
|
||||
|
||||
night.fontsize = p1;
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetFontSize %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetFontSize %d:", p1);
|
||||
}
|
||||
|
||||
// フォントの種類の設定
|
||||
@@ -200,7 +200,7 @@ static void SetFont(void) { /* 17 */
|
||||
|
||||
night.fonttype = p1;
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetFont %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetFont %d:", p1);
|
||||
}
|
||||
|
||||
// 選択肢モード ON
|
||||
@@ -209,7 +209,7 @@ static void SetSelMode(void) { /* 18 */
|
||||
|
||||
night.selmode = p1;
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetSelMode %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetSelMode %d:", p1);
|
||||
}
|
||||
|
||||
// キー入力待ち後、改ページ
|
||||
@@ -218,7 +218,7 @@ static void AnalyzeMessage(void) { /* 19 */
|
||||
|
||||
*var = ntmsg_ana();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.AnalyzeMessage %p:", var);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.AnalyzeMessage %p:", var);
|
||||
}
|
||||
|
||||
// ~DRAWの効果時間
|
||||
@@ -227,7 +227,7 @@ static void SetDrawTime(void) { /* 20 */
|
||||
|
||||
nt_gr_set_drawtime(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetDrawTime %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetDrawTime %d:", p1);
|
||||
}
|
||||
|
||||
// 効果つき画面更新
|
||||
@@ -236,7 +236,7 @@ static void Draw(void) { /* 21 */
|
||||
|
||||
nt_gr_draw(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.Draw %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.Draw %d:", p1);
|
||||
}
|
||||
|
||||
// 音声データを再生
|
||||
@@ -245,21 +245,21 @@ static void SetVoice(void) { /* 22 */
|
||||
|
||||
nt_voice_set(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetVoice %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetVoice %d:", p1);
|
||||
}
|
||||
|
||||
// 未使用
|
||||
static void WaitKey(void) { /* 23 */
|
||||
int p1 = getCaliValue(); //
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.WaitKey %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.WaitKey %d:", p1);
|
||||
}
|
||||
|
||||
static void AddFeeling(void) { /* 24 */
|
||||
int p1 = getCaliValue(); // person(1:新開,2:星川,3:百瀬,4:いずみ,5:鏡花,6:真言美,7:マコト
|
||||
int p2 = getCaliValue(); // val
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.AddFeeling %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.AddFeeling %d:", p1);
|
||||
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ static void SubFeeling(void) { /* 25 */
|
||||
int p1 = getCaliValue(); // person
|
||||
int p2 = getCaliValue(); // val
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SubFeeling %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SubFeeling %d:", p1);
|
||||
}
|
||||
|
||||
static void CallEvent(void) { /* 26 */
|
||||
@@ -275,7 +275,7 @@ static void CallEvent(void) { /* 26 */
|
||||
|
||||
nt_sco_callevent(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.CallEvent %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.CallEvent %d:", p1);
|
||||
}
|
||||
|
||||
static void ScreenCG(void) { /* 27 */
|
||||
@@ -294,7 +294,7 @@ static void ScreenCG(void) { /* 27 */
|
||||
|
||||
nt_gr_screencg(no, x, y);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.ScreenCG %d,%d,%d:", x, y, no);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.ScreenCG %d,%d,%d:", x, y, no);
|
||||
}
|
||||
|
||||
static void RunGameMain(void) { /* 28 */
|
||||
@@ -310,7 +310,7 @@ static void RunGameMain(void) { /* 28 */
|
||||
|
||||
*p1 = nt_sco_main(p5);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunGameMain %p,%d,%d,%d,%d:", p1, p2, p3, p4, p5);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.RunGameMain %p,%d,%d,%d,%d:", p1, p2, p3, p4, p5);
|
||||
}
|
||||
|
||||
static void CheckNewGame(void) { /* 29 */
|
||||
@@ -318,21 +318,21 @@ static void CheckNewGame(void) { /* 29 */
|
||||
|
||||
*p1 = 0;
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.CheckNewGame %p:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.CheckNewGame %p:", p1);
|
||||
}
|
||||
|
||||
static void SaveStartData(void) { /* 30 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SaveStartData:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SaveStartData:");
|
||||
}
|
||||
|
||||
static void PrintExitSystem(void) { /* 31 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.PrintExitSystem:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.PrintExitSystem:");
|
||||
}
|
||||
|
||||
static void SetCalendar(void) { /* 32 */
|
||||
int p1 = getCaliValue(); // 0, 1, 2
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetCalendar %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetCalendar %d:", p1);
|
||||
}
|
||||
|
||||
static void SetDate(void) { /* 33 */
|
||||
@@ -344,7 +344,7 @@ static void SetDate(void) { /* 33 */
|
||||
night.Day = p2;
|
||||
night.DayOfWeek = p3;
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetDate %d,%d,%d:", p1, p2, p3);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetDate %d,%d,%d:", p1, p2, p3);
|
||||
}
|
||||
|
||||
static void GetDate(void) { /* 34 */
|
||||
@@ -356,11 +356,11 @@ static void GetDate(void) { /* 34 */
|
||||
*p2 = night.Day;
|
||||
*p3 = night.DayOfWeek;
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetDate %p,%p,%p:", p1, p2, p3);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.GetDate %p,%p,%p:", p1, p2, p3);
|
||||
}
|
||||
|
||||
static void SelectGameLevel(void) { /* 35 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SelectGameLevel:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SelectGameLevel:");
|
||||
}
|
||||
|
||||
static void RunEventDungeon(void) { /* 36 */
|
||||
@@ -369,13 +369,13 @@ static void RunEventDungeon(void) { /* 36 */
|
||||
|
||||
*p1 = 1;
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunEventDungeon %p,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.RunEventDungeon %p,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void RunEventBattle(void) { /* 37 */
|
||||
int p1 = getCaliValue(); // 実際には機能しない?
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunEventBattle %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.RunEventBattle %d:", p1);
|
||||
}
|
||||
|
||||
// CD再生開始
|
||||
@@ -384,7 +384,7 @@ static void CDPlay(void) { /* 38 */
|
||||
|
||||
nt_cd_play(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.CDPlay %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.CDPlay %d:", p1);
|
||||
}
|
||||
|
||||
// CD再生停止
|
||||
@@ -393,16 +393,16 @@ static void CDStop(void) { /* 39 */
|
||||
|
||||
nt_cd_stop(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.CDStop %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.CDStop %d:", p1);
|
||||
}
|
||||
|
||||
// CDのmute
|
||||
static void CDMute(void) { /* 40 */
|
||||
int p1 = getCaliValue(); // 0: mute off, 1: mute on
|
||||
|
||||
nt_cd_mute(p1 == 0 ? FALSE : TRUE);
|
||||
nt_cd_mute(p1 != 0);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.CDMute %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.CDMute %d:", p1);
|
||||
}
|
||||
|
||||
// ch に効果音番号をセット
|
||||
@@ -412,7 +412,7 @@ static void SoundEffectSetWave(void) { /* 41 */
|
||||
|
||||
nt_snd_setwave(p1, p2);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetWave %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SoundEffectSetWave %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
// ch にくり返し数をセット
|
||||
@@ -422,7 +422,7 @@ static void SoundEffectSetLoop(void) { /* 42 */
|
||||
|
||||
nt_snd_setloop(p1, p2);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetLoop %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SoundEffectSetLoop %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
// ch に音量をセット
|
||||
@@ -432,7 +432,7 @@ static void SoundEffectSetVolume(void) { /* 43 */
|
||||
|
||||
nt_snd_setvol(p1, p2);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetVolue %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SoundEffectSetVolue %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
// 効果音の再生を終るまで待つか待たないか?
|
||||
@@ -440,9 +440,9 @@ static void SoundEffectSetSyncFlag(void) { /* 44 */
|
||||
int p1 = getCaliValue(); // ch
|
||||
int p2 = getCaliValue(); // 0: 終るまで待たない, 1: 待つ
|
||||
|
||||
nt_snd_waitend(p1, p2 == 0 ? FALSE : TRUE);
|
||||
nt_snd_waitend(p1, p2 != 0);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectSetSyncFlag %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SoundEffectSetSyncFlag %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
// ch の効果音を再生
|
||||
@@ -451,7 +451,7 @@ static void SoundEffectPlay(void) { /* 45 */
|
||||
|
||||
nt_snd_play(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectPlay %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SoundEffectPlay %d:", p1);
|
||||
}
|
||||
|
||||
// ch の効果音を停止
|
||||
@@ -461,7 +461,7 @@ static void SoundEffectStop(void) { /* 46 */
|
||||
|
||||
nt_snd_stop(p1, p2);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectStop %d,%d:", p1,p2);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SoundEffectStop %d,%d:", p1,p2);
|
||||
}
|
||||
|
||||
// 全てのチャンネルの再生を停止
|
||||
@@ -470,86 +470,86 @@ static void SoundEffectStopAll(void) { /* 47 */
|
||||
|
||||
nt_snd_stopall(p1);
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SoundEffectStopAll %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SoundEffectStopAll %d:", p1);
|
||||
}
|
||||
|
||||
static void RunSoundMode(void) { /* 48 */
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunSoundMode:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.RunSoundMode:");
|
||||
}
|
||||
|
||||
static void RunMapEditor(void) { /* 49 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunMapEditor %p:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.RunMapEditor %p:", p1);
|
||||
}
|
||||
|
||||
static void VisualListClear(void) { /* 50 */
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.VisualListClear:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.VisualListClear:");
|
||||
}
|
||||
|
||||
static void VisualListAdd(void) { /* 51 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.VisualListAdd %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.VisualListAdd %d:", p1);
|
||||
}
|
||||
|
||||
static void GetLocalCountCG(void) { /* 52 */
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetLocalCountCG %p,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.GetLocalCountCG %p,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void PlayMemory(void) { /* 53 */
|
||||
int *p1 = getCaliVariable(); // 回想ページ
|
||||
int *p2 = getCaliVariable(); // 回想RESULT
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.PlayMemory %p,%p:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.PlayMemory %p,%p:", p1, p2);
|
||||
}
|
||||
|
||||
static void GetEventFlagTotal(void) { /* 54 */
|
||||
int *p1 = getCaliVariable();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetEventFlagTotal %p,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.GetEventFlagTotal %p,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void SetPlayerName(void) { /* 55 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetPlayerName %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetPlayerName %d:", p1);
|
||||
}
|
||||
|
||||
static void GetPlayerName(void) { /* 56 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetPlayerName %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.GetPlayerName %d:", p1);
|
||||
}
|
||||
|
||||
static void SaveGame(void) { /* 57 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SaveGame %p:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SaveGame %p:", p1);
|
||||
}
|
||||
|
||||
static void LoadGame(void) { /* 58 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.LoadGame %p:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.LoadGame %p:", p1);
|
||||
}
|
||||
|
||||
static void ExistSaveData(void) { /* 59 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.ExistSaveData %p:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.ExistSaveData %p:", p1);
|
||||
}
|
||||
|
||||
static void ExistStartData(void) { /* 60 */
|
||||
int *p1 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.ExistStartData %p:", p1);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.ExistStartData %p:", p1);
|
||||
}
|
||||
|
||||
static void SetAreaData(void) { /* 61 */
|
||||
@@ -557,27 +557,27 @@ static void SetAreaData(void) { /* 61 */
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.SetAreaData %d,%d,%d:", p1, p2, p3);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.SetAreaData %d,%d,%d:", p1, p2, p3);
|
||||
}
|
||||
|
||||
static void RunBattleTest(void) { /* 62 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunBattleTest:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.RunBattleTest:");
|
||||
}
|
||||
|
||||
static void RunTrainingTest(void) { /* 63 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.RunTrainingTest:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.RunTrainingTest:");
|
||||
}
|
||||
|
||||
static void TestEventCall(void) { /* 64 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.TestEventCall:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.TestEventCall:");
|
||||
}
|
||||
|
||||
static void Test(void) { /* 65 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.Test:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.Test:");
|
||||
}
|
||||
|
||||
static void DebugScenario(void) { /* 66 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.DebugScenario:");
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.DebugScenario:");
|
||||
}
|
||||
|
||||
static void GetDLLTime(void) { /* 67 */
|
||||
@@ -589,7 +589,7 @@ static void GetDLLTime(void) { /* 67 */
|
||||
int *p6 = getCaliVariable();
|
||||
int *p7 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.GetDLLTime %p,%p,%p,%p,%p,%p,%p:", p1, p2, p3, p4, p5, p6, p7);
|
||||
TRACE_UNIMPLEMENTED("NIGHTDLL.GetDLLTime %p,%p,%p,%p,%p,%p,%p:", p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "config.h"
|
||||
#include "portab.h"
|
||||
#include "graphics.h"
|
||||
#include "surface.h"
|
||||
#include "ags.h"
|
||||
#include "sprite.h"
|
||||
|
||||
@@ -45,7 +44,7 @@ struct _night {
|
||||
|
||||
MyRectangle updaterect;
|
||||
|
||||
int fonttype;
|
||||
FontType fonttype;
|
||||
int fontsize;
|
||||
|
||||
sprite_t *sp[SPRITEMAX];
|
||||
@@ -55,7 +54,7 @@ struct _night {
|
||||
|
||||
// msg
|
||||
char msgbuf[MSGBUFMAX];
|
||||
boolean zhiding;
|
||||
bool zhiding;
|
||||
struct {
|
||||
void (* cbmove)(agsevent_t *);
|
||||
void (* cbrelease)(agsevent_t *);
|
||||
|
||||
+12
-19
@@ -1,11 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "cg.h"
|
||||
#include "ags.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "night.h"
|
||||
#include "sprite.h"
|
||||
#include "nt_scenario.h"
|
||||
@@ -54,8 +53,8 @@ void nt_gr_set_wallpaper(int no) {
|
||||
sp = nt_sp_new(SPNO_WALL, no, 0, 0, SPRITE_WP);
|
||||
nt_sp_add_updatelist(sp);
|
||||
if (no == 0) {
|
||||
sp->cursize.width = sf0->width;
|
||||
sp->cursize.height = sf0->height;
|
||||
sp->cursize.width = main_surface->w;
|
||||
sp->cursize.height = main_surface->h;
|
||||
sp->update = nt_sp_draw_wall;
|
||||
}
|
||||
|
||||
@@ -178,28 +177,22 @@ void nt_gr_draw(int effectno) {
|
||||
// 全消し
|
||||
break;
|
||||
case 1:
|
||||
nt_sp_update_all(TRUE);
|
||||
nt_sp_update_all(true);
|
||||
break;
|
||||
default:
|
||||
if (night.waitskiplv > 1) {
|
||||
nt_sp_update_all(TRUE);
|
||||
nt_sp_update_all(true);
|
||||
break;
|
||||
}
|
||||
//nt_sp_eupdate(effectno, effecttime, TRUE);
|
||||
nt_sp_eupdate(effectno, 1000, TRUE);
|
||||
//nt_sp_eupdate(effectno, effecttime, true);
|
||||
nt_sp_eupdate(effectno, 1000, true);
|
||||
}
|
||||
}
|
||||
|
||||
void nt_gr_screencg(int no, int x, int y) {
|
||||
surface_t *sf;
|
||||
|
||||
sf = sf_loadcg_no(no -1);
|
||||
|
||||
gre_BlendScreen(sf0, x, y, sf0, x, y, sf, 0, 0, sf->width, sf->height);
|
||||
|
||||
ags_updateArea(x, y, sf->width, sf->height);
|
||||
|
||||
sf_free(sf);
|
||||
SDL_Surface *sf = cg_load_as_sdlsurface(no - 1);
|
||||
SDL_SetSurfaceBlendMode(sf, SDL_BLENDMODE_ADD);
|
||||
SDL_BlitSurface(sf, NULL, main_surface, &(SDL_Rect){x, y, sf->w, sf->h});
|
||||
ags_updateArea(x, y, sf->w, sf->h);
|
||||
SDL_FreeSurface(sf);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+69
-91
@@ -3,6 +3,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
@@ -11,7 +12,6 @@
|
||||
#include "ags.h"
|
||||
#include "nact.h"
|
||||
#include "input.h"
|
||||
#include "ngraph.h"
|
||||
#include "drawtext.h"
|
||||
#include "night.h"
|
||||
#include "nt_msg.h"
|
||||
@@ -25,23 +25,29 @@ extern int ntsel_dosel(void);
|
||||
#define SNAME_RYO "亮 "
|
||||
#define SNAME_RYO_DEF "亮"
|
||||
|
||||
// 通常メッセージ表示位置と大きさ
|
||||
#define MSGFRAME_0_X 6
|
||||
#define MSGFRAME_0_Y 347
|
||||
#define MSGFRAME_0_WIDTH 628
|
||||
#define MSGFRAME_0_HEIGHT 125
|
||||
// Normal message window
|
||||
static const SDL_Rect msgframe_0 = {
|
||||
.x = 6,
|
||||
.y = 347,
|
||||
.w = 628,
|
||||
.h = 125
|
||||
};
|
||||
|
||||
// 画面全体メッセージ表示位置と大きさ
|
||||
#define MSGFRAME_1_X 0
|
||||
#define MSGFRAME_1_Y 0
|
||||
#define MSGFRAME_1_WIDTH 640
|
||||
#define MSGFRAME_1_HEIGHT 480
|
||||
// Full screen message window
|
||||
static const SDL_Rect msgframe_1 = {
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
.w = 640,
|
||||
.h = 480
|
||||
};
|
||||
|
||||
// 通常メッセージ(顔つき)表示位置と大きさ
|
||||
#define MSGFRAME_2_X (6+160)
|
||||
#define MSGFRAME_2_Y 347
|
||||
#define MSGFRAME_2_WIDTH (628-160)
|
||||
#define MSGFRAME_2_HEIGHT 125
|
||||
// Normal message (with face) window
|
||||
static const SDL_Rect msgframe_2 = {
|
||||
.x = 6 + 160,
|
||||
.y = 347,
|
||||
.w = 628 - 160,
|
||||
.h = 125
|
||||
};
|
||||
|
||||
// キー入力アニメーション位置
|
||||
#define HAKANIM_LOC_X 620
|
||||
@@ -69,7 +75,7 @@ void ntmsg_init() {
|
||||
sprite_t *sp;
|
||||
|
||||
// メッセージスプライト
|
||||
sp = night.sp[SPNO_MSGFRAME_FG] = nt_sp_msg_new(SPNO_MSGFRAME_FG, 0, 0, sf0->width, sf0->height);
|
||||
sp = night.sp[SPNO_MSGFRAME_FG] = nt_sp_msg_new(SPNO_MSGFRAME_FG, 0, 0, main_surface->w, main_surface->h);
|
||||
nt_sp_add_updatelist(sp);
|
||||
|
||||
// メッセージ背景用CG
|
||||
@@ -78,7 +84,7 @@ void ntmsg_init() {
|
||||
|
||||
// 文字背景CG作成
|
||||
nt_scg_create(CGNO_MSGFR_BG,
|
||||
sf0->width, sf0->height,
|
||||
main_surface->w, main_surface->h,
|
||||
0, 0, 0, 255);
|
||||
// night.cg[CGNO_MSGFR_BG]->refcnt++;
|
||||
|
||||
@@ -95,7 +101,7 @@ void ntmsg_init() {
|
||||
sp->u.anime.interval = HAKANIM_INTERVAL;
|
||||
nt_sp_add_updatelist(sp);
|
||||
nt_sp_set_loc(sp, HAKANIM_LOC_X, HAKANIM_LOC_Y);
|
||||
nt_sp_set_show(sp, FALSE);
|
||||
nt_sp_set_show(sp, false);
|
||||
sp->update = nt_sp_draw_scg;
|
||||
|
||||
|
||||
@@ -121,45 +127,34 @@ void ntmsg_init() {
|
||||
// type=1 枠あり
|
||||
// type=2 中央
|
||||
void ntmsg_set_frame(int type) {
|
||||
surface_t *sf;
|
||||
|
||||
night.msgframe = type;
|
||||
|
||||
sf = night.sp[SPNO_MSGBG]->curcg->sf;
|
||||
memset(sf->pixel, 0, sf->bytes_per_line * sf->height);
|
||||
memset(sf->alpha, 0, sf->width * sf->height);
|
||||
SDL_Surface *sf = night.sp[SPNO_MSGBG]->curcg->sf;
|
||||
SDL_FillRect(sf, NULL, 0);
|
||||
|
||||
switch(type) {
|
||||
case 0:
|
||||
nt_sp_set_show(night.sp[SPNO_MSGBG], FALSE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_BG], FALSE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_FG], FALSE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGBG], false);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_BG], false);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_FG], false);
|
||||
break;
|
||||
case 1:
|
||||
nt_sp_set_show(night.sp[SPNO_MSGBG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_BG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_FG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGBG], true);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_BG], true);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_FG], true);
|
||||
|
||||
gr_fill(sf, MSGFRAME_0_X, MSGFRAME_0_Y,
|
||||
MSGFRAME_0_WIDTH, MSGFRAME_0_HEIGHT,
|
||||
16, 32, 64);
|
||||
gr_fill_alpha_map(sf, MSGFRAME_0_X, MSGFRAME_0_Y,
|
||||
MSGFRAME_0_WIDTH, MSGFRAME_0_HEIGHT, 192);
|
||||
SDL_FillRect(sf, &msgframe_0, SDL_MapRGBA(sf->format, 16, 32, 64, 192));
|
||||
ntmsg_clear(SPNO_MSGFRAME_FG);
|
||||
nt_sp_update_all(TRUE);
|
||||
nt_sp_update_all(true);
|
||||
break;
|
||||
case 2:
|
||||
nt_sp_set_show(night.sp[SPNO_MSGBG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_BG], FALSE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_FG], TRUE);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGBG], true);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_BG], false);
|
||||
nt_sp_set_show(night.sp[SPNO_MSGFRAME_FG], true);
|
||||
|
||||
gr_fill(sf, MSGFRAME_1_X, MSGFRAME_1_Y,
|
||||
MSGFRAME_1_WIDTH, MSGFRAME_1_HEIGHT,
|
||||
32, 32, 32);
|
||||
gr_fill_alpha_map(sf, MSGFRAME_1_X, MSGFRAME_1_Y,
|
||||
MSGFRAME_1_WIDTH, MSGFRAME_1_HEIGHT, 128);
|
||||
SDL_FillRect(sf, &msgframe_1, SDL_MapRGBA(sf->format, 32, 32, 32, 128));
|
||||
ntmsg_clear(SPNO_MSGFRAME_FG);
|
||||
nt_sp_update_all(TRUE);
|
||||
nt_sp_update_all(true);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -221,7 +216,7 @@ int ntmsg_ana(void) {
|
||||
static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wFont, int wSpeed, int wLineSpace) {
|
||||
char *msg;
|
||||
sprite_t *sp;
|
||||
boolean needupdate = FALSE;
|
||||
bool needupdate = false;
|
||||
MyRectangle uparea = {0,0,0,0};
|
||||
int savex;
|
||||
|
||||
@@ -260,7 +255,7 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
mbuf,
|
||||
wColorR, wColorG, wColorB);
|
||||
|
||||
needupdate = TRUE;
|
||||
needupdate = true;
|
||||
|
||||
if (wSpeed > 0) {
|
||||
nt_sp_updateme_part(sp,
|
||||
@@ -269,7 +264,7 @@ static void ntmsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB
|
||||
cw,
|
||||
wSize);
|
||||
nt_sp_update_clipped();
|
||||
needupdate = FALSE;
|
||||
needupdate = false;
|
||||
|
||||
// keywait
|
||||
delta = sdl_getTicks() - wcnt;
|
||||
@@ -337,8 +332,8 @@ static void set_align(char *msg, sprite_t *sp, int wSize) {
|
||||
|
||||
switch(night.msgplace) {
|
||||
case 0:
|
||||
sp->u.msg.dspcur.x = MSGFRAME_0_X;
|
||||
sp->u.msg.dspcur.y = MSGFRAME_0_Y + 8;
|
||||
sp->u.msg.dspcur.x = msgframe_0.x;
|
||||
sp->u.msg.dspcur.y = msgframe_0.y + 8;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@@ -364,8 +359,8 @@ static void set_align(char *msg, sprite_t *sp, int wSize) {
|
||||
sp->u.msg.dspcur.y = (sp->cursize.height - (line * (wSize+2))) /2;
|
||||
break;
|
||||
case 2:
|
||||
sp->u.msg.dspcur.x = MSGFRAME_2_X;
|
||||
sp->u.msg.dspcur.y = MSGFRAME_2_Y + 8;
|
||||
sp->u.msg.dspcur.x = msgframe_2.x;
|
||||
sp->u.msg.dspcur.y = msgframe_2.y + 8;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -424,7 +419,7 @@ static void setup_hakanim() {
|
||||
// メッセージ表示時のキー入力を促すアニメーション
|
||||
static void hakanim(int i) {
|
||||
sprite_t *sp;
|
||||
boolean show;
|
||||
bool show;
|
||||
|
||||
sp = night.sp[SPNO_MSG_KEYANIM];
|
||||
if (sp == NULL) return;
|
||||
@@ -434,60 +429,43 @@ static void hakanim(int i) {
|
||||
} else {
|
||||
sp->curcg = sp->cg2;
|
||||
}
|
||||
sp->show = TRUE;
|
||||
sp->show = true;
|
||||
nt_sp_updateme(sp);
|
||||
nt_sp_update_clipped();
|
||||
|
||||
sp->show = show;
|
||||
}
|
||||
|
||||
int ntmsg_update(sprite_t *sp, MyRectangle *r) {
|
||||
int sx, sy, w, h, dx, dy;
|
||||
surface_t update;
|
||||
|
||||
// canvas が clean のときはなにもしない
|
||||
// -> 説明スプライトのように、SetShowされたときに対応できないからだめ
|
||||
//if (sact.msgbufempty) return OK;
|
||||
|
||||
update.width = r->w;
|
||||
update.height = r->h;
|
||||
|
||||
dx = sp->cur.x - r->x;
|
||||
dy = sp->cur.y - r->y;
|
||||
|
||||
w = sp->cursize.width;
|
||||
h = sp->cursize.height;
|
||||
|
||||
sx = 0; sy = 0;
|
||||
|
||||
if (!gr_clip(sp->u.msg.canvas, &sx, &sy, &w, &h, &update, &dx, &dy)) {
|
||||
return NG;
|
||||
void ntmsg_update(sprite_t *sp, MyRectangle *r) {
|
||||
SDL_Rect sp_rect = {0, 0, sp->cursize.width, sp->cursize.height};
|
||||
int sx = 0;
|
||||
int sy = 0;
|
||||
int dx = sp->cur.x;
|
||||
int dy = sp->cur.y;
|
||||
int w = sp->cursize.width;
|
||||
int h = sp->cursize.height;
|
||||
if (!ags_clipCopyRect(&sp_rect, r, &sx, &sy, &dx, &dy, &w, &h)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dx += r->x;
|
||||
dy += r->y;
|
||||
|
||||
gre_BlendUseAMap(sf0, dx, dy, sf0, dx, dy, sp->u.msg.canvas, sx, sy, w, h, sp->u.msg.canvas, sx, sy, sp->blendrate);
|
||||
|
||||
|
||||
SDL_SetSurfaceBlendMode(sp->u.msg.canvas, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetSurfaceAlphaMod(sp->u.msg.canvas, sp->blendrate);
|
||||
SDL_BlitSurface(sp->u.msg.canvas, &(SDL_Rect){sx, sy, w, h}, main_surface, &(SDL_Rect){dx, dy, w, h});
|
||||
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d",
|
||||
sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void ntmsg_clear(int wNum) {
|
||||
sprite_t *sp = night.sp[wNum];
|
||||
surface_t *sf;
|
||||
|
||||
|
||||
sp->u.msg.dspcur.x = 0;
|
||||
sp->u.msg.dspcur.y = 0;
|
||||
|
||||
night.msgbuf[0] = '\0';
|
||||
|
||||
// キャンバスのクリア
|
||||
sf = sp->u.msg.canvas;
|
||||
memset(sf->pixel, 0, sf->bytes_per_line * sf->height);
|
||||
memset(sf->alpha, 0, sf->width * sf->height);
|
||||
|
||||
|
||||
// Clear the canvas
|
||||
SDL_FillRect(sp->u.msg.canvas, NULL, 0);
|
||||
|
||||
nt_sp_updateme(sp);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef __NT_MSG_H__
|
||||
#define __NT_MSG_H__
|
||||
|
||||
extern void ntmsg_init();
|
||||
extern void ntmsg_set_frame(int type);
|
||||
extern void ntmsg_set_place(int type);
|
||||
extern void ntmsg_newline();
|
||||
extern void ntmsg_add(const char *msg);
|
||||
extern int ntmsg_ana(void);
|
||||
extern int ntmsg_update(sprite_t *sp, MyRectangle *r);
|
||||
void ntmsg_init();
|
||||
void ntmsg_set_frame(int type);
|
||||
void ntmsg_set_place(int type);
|
||||
void ntmsg_newline();
|
||||
void ntmsg_add(const char *msg);
|
||||
int ntmsg_ana(void);
|
||||
void ntmsg_update(sprite_t *sp, MyRectangle *r);
|
||||
|
||||
#endif /* __NT_MSG_H__ */
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "system.h"
|
||||
#include "input.h"
|
||||
#include "sdl_core.h"
|
||||
#include "scheduler.h"
|
||||
#include "xsystem35.h"
|
||||
#include "nact.h"
|
||||
#include "scenario.h"
|
||||
@@ -52,7 +53,8 @@ static void ntmain(struct _scoadr inadr) {
|
||||
struct _scoadr curadr;
|
||||
|
||||
while (!nact->is_quit) {
|
||||
for (int cnt = 0; !nact->is_quit && !nact->wait_vsync && cnt < 10000; cnt++) {
|
||||
while (!nact->is_quit && !is_yield_requested()) {
|
||||
scheduler_on_command();
|
||||
//SACT_DEBUG("%d:%x", sl_getPage(), sl_getIndex());
|
||||
if (!nact->popupmenu_opened) {
|
||||
exec_command();
|
||||
@@ -71,9 +73,7 @@ static void ntmain(struct _scoadr inadr) {
|
||||
nact->callback();
|
||||
}
|
||||
sys_getInputInfo();
|
||||
sdl_wait_vsync();
|
||||
nact->frame_count++;
|
||||
nact->wait_vsync = FALSE;
|
||||
scheduler_yield();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,9 +107,9 @@ void nt_sco_callevent(int ev) {
|
||||
}
|
||||
|
||||
|
||||
boolean nt_sco_is_natsu() {
|
||||
if (night.Month < 6 || night.Month > 9) return FALSE;
|
||||
if (night.Month == 6 && night.Day < 11) return FALSE;
|
||||
return TRUE;
|
||||
bool nt_sco_is_natsu() {
|
||||
if (night.Month < 6 || night.Month > 9) return false;
|
||||
if (night.Month == 6 && night.Day < 11) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
extern void nt_sco_init();
|
||||
extern int nt_sco_main(int mode);
|
||||
extern boolean nt_sco_is_natsu();
|
||||
extern bool nt_sco_is_natsu();
|
||||
extern void nt_sco_callevent(int ev);
|
||||
|
||||
#endif /* __NT_SCENARIO_H__ */
|
||||
|
||||
@@ -10,7 +10,7 @@ struct _ntsnd {
|
||||
int no;
|
||||
int vol;
|
||||
int loop;
|
||||
boolean waitend;
|
||||
bool waitend;
|
||||
};
|
||||
static struct _ntsnd ntsnd[10];
|
||||
|
||||
@@ -27,14 +27,14 @@ void nt_cd_play(int no) {
|
||||
}
|
||||
|
||||
void nt_cd_stop(int msec) {
|
||||
mus_mixer_fadeout_start(MIX_CD, msec, 0, TRUE);
|
||||
mus_mixer_fadeout_start(MIX_CD, msec, 0, true);
|
||||
}
|
||||
|
||||
void nt_cd_mute(boolean mute) {
|
||||
void nt_cd_mute(bool mute) {
|
||||
if (mute) {
|
||||
mus_mixer_fadeout_start(MIX_CD, 0, 0, FALSE);
|
||||
mus_mixer_fadeout_start(MIX_CD, 0, 0, false);
|
||||
} else {
|
||||
mus_mixer_fadeout_start(MIX_CD, 0, 100, FALSE);
|
||||
mus_mixer_fadeout_start(MIX_CD, 0, 100, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void nt_snd_setvol(int ch, int vol) {
|
||||
ntsnd[ch -1].vol = vol;
|
||||
}
|
||||
|
||||
void nt_snd_waitend(int ch, boolean waitend) {
|
||||
void nt_snd_waitend(int ch, bool waitend) {
|
||||
if (ch < 1) return;
|
||||
|
||||
ntsnd[ch -1].waitend = waitend;
|
||||
@@ -74,13 +74,13 @@ void nt_snd_play(int ch) {
|
||||
void nt_snd_stop(int ch, int msec) {
|
||||
if (ch < 1) return;
|
||||
|
||||
mus_wav_fadeout_start(ch, msec, 0, TRUE);
|
||||
mus_wav_fadeout_start(ch, msec, 0, true);
|
||||
}
|
||||
|
||||
void nt_snd_stopall(int msec) {
|
||||
int i;
|
||||
|
||||
for (i = 1; i <= 10; i++) {
|
||||
mus_wav_fadeout_start(i, msec, 0, TRUE);
|
||||
mus_wav_fadeout_start(i, msec, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
extern void nt_voice_set(int no);
|
||||
extern void nt_cd_play(int no);
|
||||
extern void nt_cd_stop(int msec);
|
||||
extern void nt_cd_mute(boolean mute);
|
||||
extern void nt_cd_mute(bool mute);
|
||||
extern void nt_snd_setwave(int ch, int no);
|
||||
extern void nt_snd_setloop(int ch, int num);
|
||||
extern void nt_snd_setvol(int ch, int vol);
|
||||
extern void nt_snd_waitend(int ch, boolean waitend);
|
||||
extern void nt_snd_waitend(int ch, bool waitend);
|
||||
extern void nt_snd_play(int ch);
|
||||
extern void nt_snd_stop(int ch, int msec);
|
||||
extern void nt_snd_stopall(int msec);
|
||||
|
||||
+21
-220
@@ -26,29 +26,25 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "nact.h"
|
||||
#include "system.h"
|
||||
#include "ags.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "cg.h"
|
||||
#include "sactcg.h"
|
||||
|
||||
#define CGMAX 65536
|
||||
static cginfo_t *cgs[CGMAX];
|
||||
|
||||
#include "sactcg_stretch.c"
|
||||
#include "sactcg_blend.c"
|
||||
|
||||
|
||||
#define spcg_assert_no(no) \
|
||||
#define SPCG_ASSERT_NO(no) \
|
||||
if ((no) > (CGMAX -1)) { \
|
||||
WARNING("no is too large (should be %d < %d)", (no), CGMAX); \
|
||||
return NG; \
|
||||
return; \
|
||||
} \
|
||||
|
||||
static cginfo_t *nt_scg_new(enum cgtype type, int no, surface_t *sf) {
|
||||
static cginfo_t *nt_scg_new(enum cgtype type, int no, SDL_Surface *sf) {
|
||||
cginfo_t *info = calloc(1, sizeof(cginfo_t));
|
||||
info->type = type;
|
||||
info->no = no;
|
||||
@@ -78,7 +74,7 @@ static cginfo_t *nt_scg_get(int no) {
|
||||
if (cgs[no] != NULL)
|
||||
return cgs[no];
|
||||
|
||||
surface_t *sf = sf_loadcg_no(no - 1);
|
||||
SDL_Surface *sf = cg_load_as_sdlsurface(no - 1);
|
||||
if (!sf) {
|
||||
WARNING("load fail (%d)", no -1);
|
||||
return NULL;
|
||||
@@ -98,248 +94,53 @@ void nt_scg_deref(cginfo_t *cg) {
|
||||
return;
|
||||
|
||||
if (cg->sf)
|
||||
sf_free(cg->sf);
|
||||
SDL_FreeSurface(cg->sf);
|
||||
free(cg);
|
||||
}
|
||||
|
||||
// 指定の大きさ、色の矩形の CG を作成
|
||||
int nt_scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate) {
|
||||
spcg_assert_no(wNumCG);
|
||||
void nt_scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate) {
|
||||
SPCG_ASSERT_NO(wNumCG);
|
||||
|
||||
surface_t *sf = sf_create_surface(wWidth, wHeight, sf0->depth);
|
||||
gr_fill(sf, 0, 0, wWidth, wHeight, wR, wG, wB);
|
||||
gr_fill_alpha_map(sf, 0, 0, wWidth, wHeight, wBlendRate);
|
||||
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, wWidth, wHeight, 32, SDL_PIXELFORMAT_ARGB8888);
|
||||
SDL_FillRect(sf, NULL, SDL_MapRGBA(sf->format, wR, wG, wB, wBlendRate));
|
||||
nt_scg_new(CG_SET, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定のCGを反転させたCGを作成
|
||||
int nt_scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY) {
|
||||
spcg_assert_no(wNumCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = nt_scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
|
||||
surface_t *sf = stretch(src->sf, src->sf->width, src->sf->height, (wReverseX << 1) | wReverseY);
|
||||
nt_scg_new(CG_REVERSE, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定のCGを拡大/縮小したCGを作成
|
||||
int nt_scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) {
|
||||
spcg_assert_no(wNumCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = nt_scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
|
||||
surface_t *sf = stretch(src->sf, wWidth, wHeight, 0);
|
||||
nt_scg_new(CG_STRETCH, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// ベースCGの上にブレンドCGを重ねた CG を作成
|
||||
int nt_scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode) {
|
||||
spcg_assert_no(wNumDstCG);
|
||||
spcg_assert_no(wNumBaseCG);
|
||||
spcg_assert_no(wNumBlendCG);
|
||||
|
||||
cginfo_t *basecg = nt_scg_get(wNumBaseCG);
|
||||
cginfo_t *blendcg = nt_scg_get(wNumBlendCG);
|
||||
if (!basecg || !blendcg) return NG;
|
||||
|
||||
surface_t *sf = blend(basecg->sf, wX, wY, blendcg->sf, wAlphaMapMode);
|
||||
nt_scg_new(CG_SET, wNumDstCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定の文字列のCGを作成
|
||||
int nt_scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText) {
|
||||
spcg_assert_no(wNumCG);
|
||||
|
||||
// 勝手に出ていいのかな?
|
||||
if (strlen(cText) == 0) return OK;
|
||||
|
||||
ags_setFont(FONT_GOTHIC, wSize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(cText);
|
||||
|
||||
surface_t *sf = sf_create_surface(glyph->width, wSize, nact->ags.dib->depth);
|
||||
gr_fill(sf, 0, 0, glyph->width, wSize, wR, wG, wB);
|
||||
gr_draw_amap(sf, 0, 0, glyph->pixel, glyph->width, wSize, glyph->bytes_per_line);
|
||||
|
||||
nt_scg_new(CG_SET, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 数字文字列のCGを作成
|
||||
int nt_scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue) {
|
||||
spcg_assert_no(wNumCG);
|
||||
|
||||
char s[256], ss[256];
|
||||
if (wZeroPadding) {
|
||||
char *sss = "%%0%dd";
|
||||
sprintf(ss, sss, wFigs);
|
||||
} else {
|
||||
char *sss = "%%%dd";
|
||||
sprintf(ss, sss, wFigs);
|
||||
}
|
||||
sprintf(s, ss, wValue);
|
||||
|
||||
ags_setFont(FONT_GOTHIC, wSize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(s);
|
||||
|
||||
surface_t *sf = sf_create_surface(glyph->width, wSize, nact->ags.dib->depth);
|
||||
gr_fill(sf, 0, 0, glyph->width, wSize, wR, wG, wB);
|
||||
gr_draw_amap(sf, 0, 0, glyph->pixel, glyph->width, wSize, glyph->bytes_per_line);
|
||||
|
||||
nt_scg_new(CG_SET, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// CGを複製
|
||||
int nt_scg_copy(int wNumDstCG, int wNumSrcCG) {
|
||||
spcg_assert_no(wNumDstCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = nt_scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
|
||||
nt_scg_new(CG_SET, wNumDstCG, sf_dup(src->sf));
|
||||
return OK;
|
||||
}
|
||||
|
||||
// CGの一部を切りぬいたCGを作成
|
||||
int nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
spcg_assert_no(wNumDstCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
void nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
SPCG_ASSERT_NO(wNumDstCG);
|
||||
SPCG_ASSERT_NO(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = nt_scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
return;
|
||||
|
||||
surface_t *sf = src->sf->alpha
|
||||
? sf_create_surface(wWidth, wHeight, src->sf->depth)
|
||||
: sf_create_pixel(wWidth, wHeight, src->sf->depth);
|
||||
|
||||
if (src->sf->pixel)
|
||||
gr_copy(sf, 0, 0, src->sf, wX, wY, wWidth, wHeight);
|
||||
if (src->sf->alpha)
|
||||
gr_copy_alpha_map(sf, 0, 0, src->sf, wX, wY, wWidth, wHeight);
|
||||
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, wWidth, wHeight, src->sf->format->BitsPerPixel, src->sf->format->format);
|
||||
SDL_BlitSurface(src->sf, &(SDL_Rect){wX, wY, wWidth, wHeight}, sf, NULL);
|
||||
|
||||
nt_scg_new(CG_SET, wNumDstCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 元のCGの一部を切りぬいたCGを作成
|
||||
int nt_scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
spcg_assert_no(wNumDstCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = nt_scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
|
||||
surface_t *sf;
|
||||
if (src->sf->alpha) {
|
||||
sf = sf_create_surface(src->sf->width, src->sf->height, src->sf->depth);
|
||||
gr_fill_alpha_map(sf, 0, 0, src->sf->width, src->sf->height, 255);
|
||||
} else {
|
||||
sf = sf_create_pixel(src->sf->width, src->sf->height, src->sf->depth);
|
||||
}
|
||||
|
||||
if (src->sf->pixel)
|
||||
gr_copy(sf, wX, wY, src->sf, wX, wY, wWidth, wHeight);
|
||||
if (src->sf->alpha)
|
||||
gr_copy_alpha_map(sf, wX, wY, src->sf, wX, wY, wWidth, wHeight);
|
||||
|
||||
nt_scg_new(CG_SET, wNumDstCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 全てのCGの開放
|
||||
int nt_scg_freeall() {
|
||||
void nt_scg_freeall(void) {
|
||||
int i;
|
||||
|
||||
for (i = 1; i < CGMAX; i++) {
|
||||
nt_scg_free(i);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定の番号の CG をオブジェクトリストから消し、オブジェクトがどこからも参照
|
||||
* されていない(参照数が0の)場合のみ、オブジェクトを削除
|
||||
*/
|
||||
int nt_scg_free(int no) {
|
||||
spcg_assert_no(no);
|
||||
void nt_scg_free(int no) {
|
||||
SPCG_ASSERT_NO(no);
|
||||
|
||||
cginfo_t *cg = cgs[no];
|
||||
if (!cg) return NG;
|
||||
if (!cg) return;
|
||||
|
||||
nt_scg_deref(cg);
|
||||
cgs[no] = NULL;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// CGの種類を取得
|
||||
int nt_scg_querytype(int wNumCG, int *ret) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (cgs[wNumCG] == NULL) goto errexit;
|
||||
|
||||
*ret = cgs[wNumCG]->type;
|
||||
|
||||
return OK;
|
||||
|
||||
errexit:
|
||||
*ret = CG_NOTUSED;
|
||||
return NG;
|
||||
}
|
||||
|
||||
// CGの大きさを取得
|
||||
int nt_scg_querysize(int wNumCG, int *w, int *h) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (cgs[wNumCG] == NULL) goto errexit;
|
||||
if (cgs[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*w = cgs[wNumCG]->sf->width;
|
||||
*h = cgs[wNumCG]->sf->height;
|
||||
|
||||
return OK;
|
||||
|
||||
errexit:
|
||||
*w = *h = 0;
|
||||
return NG;
|
||||
}
|
||||
|
||||
// CGのBPPを取得
|
||||
int nt_scg_querybpp(int wNumCG, int *ret) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (cgs[wNumCG] == NULL) goto errexit;
|
||||
if (cgs[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*ret = cgs[wNumCG]->sf->depth;
|
||||
|
||||
return OK;
|
||||
|
||||
errexit:
|
||||
*ret = 0;
|
||||
return NG;
|
||||
}
|
||||
|
||||
// CGの alphamap が存在するかを取得
|
||||
int nt_scg_existalphamap(int wNumCG, int *ret) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (cgs[wNumCG] == NULL) goto errexit;
|
||||
if (cgs[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*ret = cgs[wNumCG]->sf->alpha ? 1 : 0;
|
||||
|
||||
errexit:
|
||||
*ret = 0;
|
||||
return NG;
|
||||
}
|
||||
|
||||
@@ -27,23 +27,11 @@
|
||||
#include "portab.h"
|
||||
#include "night.h"
|
||||
|
||||
extern cginfo_t *nt_scg_addref(int no);
|
||||
extern void nt_scg_deref(cginfo_t *cg);
|
||||
extern int nt_scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate);
|
||||
extern int nt_scg_create_reverse(int NumCG, int wNumSrcCG, int wReverseX, int wReverseY);
|
||||
extern int nt_scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG);
|
||||
extern int nt_scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode);
|
||||
extern int nt_scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, char *cText);
|
||||
extern int nt_scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue);
|
||||
extern int nt_scg_copy(int wNumDstCG, int wNumSrcCG);
|
||||
extern int nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
extern int nt_scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
extern int nt_scg_freeall();
|
||||
extern int nt_scg_free(int cg);
|
||||
extern int nt_scg_querytype(int wNumCG, int *ret);
|
||||
extern int nt_scg_querysize(int wNumCG, int *w, int *h);
|
||||
extern int nt_scg_querybpp(int wNumCG, int *ret);
|
||||
extern int nt_scg_existalphamap(int wNumCG, int *ret);
|
||||
extern int nt_scg_linkcgfree(int no);
|
||||
cginfo_t *nt_scg_addref(int no);
|
||||
void nt_scg_deref(cginfo_t *cg);
|
||||
void nt_scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate);
|
||||
void nt_scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
void nt_scg_freeall(void);
|
||||
void nt_scg_free(int cg);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
//
|
||||
static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mode) {
|
||||
surface_t *dst = sf_create_surface(base->width, base->height, base->depth);
|
||||
|
||||
gr_copy(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
|
||||
if (base->alpha) {
|
||||
// ベースに alpha map がある場合はそれをコピー
|
||||
gr_copy_alpha_map(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
} else {
|
||||
// 無い場合は全て 255 の map を作成
|
||||
gr_fill_alpha_map(dst, 0, 0, base->width, base->height, 255);
|
||||
}
|
||||
|
||||
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 {
|
||||
// 無いときは dst の alpha map を使う
|
||||
gre_BlendUseAMap(dst, x, y, base, x, y, blend, 0, 0, blend->width, blend->height, dst, x, y, 255);
|
||||
}
|
||||
|
||||
// alpha 作成モードが dst + blend の時は飽和加算
|
||||
if (mode == 1) {
|
||||
gr_saturadd_alpha_map(dst, x, y, blend, 0, 0, blend->width, blend->height);
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
// 拡大縮小
|
||||
static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
surface_t *dst = calloc(1, sizeof(surface_t));
|
||||
float a1, a2, xd, yd;
|
||||
int sw, sh;
|
||||
int *row, *col;
|
||||
int x, y;
|
||||
uint8_t *sdata, *ddata;
|
||||
|
||||
dst->width = dw;
|
||||
dst->height = dh;
|
||||
dst->depth = src->depth;
|
||||
dst->bytes_per_line = dw * src->bytes_per_pixel;
|
||||
dst->bytes_per_pixel = src->bytes_per_pixel;
|
||||
|
||||
if (src->pixel) {
|
||||
dst->pixel = malloc(dh * dst->bytes_per_line);
|
||||
}
|
||||
if (src->alpha) {
|
||||
dst->alpha = malloc(dw * dh);
|
||||
}
|
||||
|
||||
|
||||
sdata = GETOFFSET_PIXEL(src, 0, 0);
|
||||
ddata = GETOFFSET_PIXEL(dst, 0, 0);
|
||||
sw = src->width;
|
||||
sh = src->height;
|
||||
|
||||
a1 = (float)sw / (float)dw;
|
||||
a2 = (float)sh / (float)dh;
|
||||
row = malloc(sizeof(int) * dw);
|
||||
// 1おおきくして初期化しないと col[dw-1]とcol[dw]が同じになる
|
||||
// 可能性がある。
|
||||
col = calloc(dh +1, sizeof(int));
|
||||
|
||||
if (mirror & 1) {
|
||||
/* 上下反転 added by tajiri@wizard */
|
||||
for (yd = sh - a2, y = 0; y < dh; y++) {
|
||||
col[y] = yd; yd -= a2;
|
||||
}
|
||||
} else {
|
||||
for (yd = 0.0, y = 0; y < dh; y++) {
|
||||
col[y] = yd; yd += a2;
|
||||
}
|
||||
}
|
||||
if (mirror & 2) {
|
||||
/* 左右反転 added by tajiri@wizard */
|
||||
for (xd = sw - a1, x = 0; x < dw; x++) {
|
||||
row[x] = xd; xd -= a1;
|
||||
}
|
||||
} else {
|
||||
for (xd = 0.0, x = 0; x < dw; x++) {
|
||||
row[x] = xd; xd += a1;
|
||||
}
|
||||
}
|
||||
|
||||
#define SCALEDCOPYAREA(type) { \
|
||||
int x, y; \
|
||||
type *sl, *dl; \
|
||||
uint8_t *_sl, *_dl; \
|
||||
for (y = 0; y < dh; y++) { \
|
||||
sl = (type *)(sdata + *(y + col) * src->bytes_per_line);\
|
||||
dl = (type *)(ddata + y * dst->bytes_per_line);\
|
||||
for (x = 0; x < dw; x++) { \
|
||||
*(dl + x) = *(sl + *(row + x)); \
|
||||
} \
|
||||
_dl = (uint8_t *)dl; \
|
||||
while(*(col + y) == *(col + y + 1)) { \
|
||||
_sl = _dl; \
|
||||
_dl += dst->bytes_per_line; \
|
||||
memcpy(_dl, _sl, dw * sizeof(type)); \
|
||||
y++; \
|
||||
} \
|
||||
}}
|
||||
|
||||
switch(dst->depth) {
|
||||
case 8:
|
||||
SCALEDCOPYAREA(uint8_t); break;
|
||||
case 16:
|
||||
SCALEDCOPYAREA(uint16_t); break;
|
||||
case 24:
|
||||
case 32:
|
||||
SCALEDCOPYAREA(uint32_t); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (src->alpha) {
|
||||
int x, y;
|
||||
uint8_t *sl, *dl;
|
||||
uint8_t *_sl, *_dl;
|
||||
sdata = GETOFFSET_ALPHA(src, 0, 0);
|
||||
ddata = GETOFFSET_ALPHA(dst, 0, 0);
|
||||
for (y = 0; y < dh; y++) {
|
||||
sl = (uint8_t *)(sdata + *(y + col) * src->width);
|
||||
dl = (uint8_t *)(ddata + y * dst->width);
|
||||
for (x = 0; x < dw; x++) {
|
||||
*(dl + x) = *(sl + *(row + x));
|
||||
}
|
||||
_dl = (uint8_t *)dl;
|
||||
while(*(col + y) == *(col + y + 1)) {
|
||||
_sl = _dl;
|
||||
_dl += dst->width;
|
||||
memcpy(_dl, _sl, dw);
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(row);
|
||||
free(col);
|
||||
|
||||
return dst;
|
||||
}
|
||||
@@ -51,14 +51,13 @@ static char *replacedst;
|
||||
/**
|
||||
* 文字列変数スタックの初期化
|
||||
*/
|
||||
int nt_sstr_init() {
|
||||
void nt_sstr_init(void) {
|
||||
stack = malloc(sizeof(char *) * DEFSTACKSIZE);
|
||||
idx = 0;
|
||||
idxmax = DEFSTACKSIZE;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int nt_sstr_reset(void) {
|
||||
void nt_sstr_reset(void) {
|
||||
for (int i = 0; i < idx; i++)
|
||||
free(stack[i]);
|
||||
idx = 0;
|
||||
@@ -73,35 +72,6 @@ int nt_sstr_reset(void) {
|
||||
}
|
||||
slist_free(strreplace);
|
||||
strreplace = NULL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字列変数スタックに文字列を積む
|
||||
* @param strno: シナリオ上での文字列変数番号
|
||||
*/
|
||||
int nt_sstr_push(char *str) {
|
||||
if (idx >= idxmax) {
|
||||
stack = realloc(stack, sizeof(char *) * idx*2);
|
||||
idxmax = idx*2;
|
||||
}
|
||||
|
||||
stack[idx++] = strdup(str);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字列変数スタックから文字列を取り出す
|
||||
* @param strno: スタックから戻した文字列を格納する文字列変数番号
|
||||
*/
|
||||
int nt_sstr_pop(char *str, int maxlen) {
|
||||
if (idx == 0) return NG;
|
||||
|
||||
strncpy(str, stack[--idx], maxlen);
|
||||
free(stack[idx]);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,36 +79,15 @@ int nt_sstr_pop(char *str, int maxlen) {
|
||||
* @param sstrno: 変換元文字列変数番号
|
||||
* @param dstrno: 変換先文字列変数番号
|
||||
*/
|
||||
int nt_sstr_regist_replace(char *sstr, char *dstr) {
|
||||
void nt_sstr_regist_replace(char *sstr, char *dstr) {
|
||||
strexchange_t *ex;
|
||||
|
||||
if (sstr == dstr) return NG;
|
||||
if (sstr == dstr) return;
|
||||
|
||||
ex = malloc(sizeof(strexchange_t));
|
||||
ex->src = sstr;
|
||||
ex->dst = dstr;
|
||||
strreplace = slist_append(strreplace, ex);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数値 -> 文字列化
|
||||
*/
|
||||
int nt_sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
char s[256], ss[256];
|
||||
|
||||
if (nzeropad) {
|
||||
char *sss = "%%0%dd";
|
||||
sprintf(ss, sss, fig);
|
||||
} else {
|
||||
char *sss = "%%%dd";
|
||||
sprintf(ss, sss, fig);
|
||||
}
|
||||
|
||||
sprintf(s, ss, num);
|
||||
svar_set(strno, s);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 文字列の置き換え処理
|
||||
@@ -151,7 +100,7 @@ static void replacestr_cb(void* data, void* userdata) {
|
||||
start = replacesrc;
|
||||
out = replacedst;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
next = strstr(start, ex->src);
|
||||
if (next == NULL) break;
|
||||
strncat(out, start, (size_t)(next - start));
|
||||
|
||||
@@ -24,13 +24,10 @@
|
||||
#ifndef __SACTSTRING_H__
|
||||
#define __SACTSTRING_H__
|
||||
|
||||
extern int nt_sstr_init();
|
||||
extern int nt_sstr_reset(void);
|
||||
extern int nt_sstr_push(char *str);
|
||||
extern int nt_sstr_pop(char *str, int maxlen);
|
||||
extern int nt_sstr_regist_replace(char *sstr, char *dstr);
|
||||
extern int nt_sstr_num2str(int strno, int fig, int nzeropad, int num);
|
||||
extern char *nt_sstr_replacestr(char *msg);
|
||||
void nt_sstr_init(void);
|
||||
void nt_sstr_reset(void);
|
||||
void nt_sstr_regist_replace(char *sstr, char *dstr);
|
||||
char *nt_sstr_replacestr(char *msg);
|
||||
|
||||
|
||||
#endif /* __SACTSTRING_H__ */
|
||||
|
||||
+11
-12
@@ -1,12 +1,11 @@
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "sprite.h"
|
||||
#include "sactcg.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "nt_msg.h"
|
||||
|
||||
sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
@@ -22,7 +21,7 @@ sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
sp->cg3 = cg3 ? nt_scg_addref(cg3) : NULL;
|
||||
|
||||
sp->curcg = sp->cg1;
|
||||
sp->show = TRUE;
|
||||
sp->show = true;
|
||||
sp->blendrate = 255;
|
||||
sp->loc.x = 0;
|
||||
sp->loc.y = 0;
|
||||
@@ -32,8 +31,8 @@ sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
sp->cursize.width = 0;
|
||||
sp->cursize.height = 0;
|
||||
} else {
|
||||
sp->cursize.width = sp->curcg->sf->width;
|
||||
sp->cursize.height = sp->curcg->sf->height;
|
||||
sp->cursize.width = sp->curcg->sf->w;
|
||||
sp->cursize.height = sp->curcg->sf->h;
|
||||
}
|
||||
sp->update = DEFAULT_UPDATE;
|
||||
|
||||
@@ -54,7 +53,7 @@ sprite_t *nt_sp_msg_new(int no, int x, int y, int width, int height) {
|
||||
|
||||
sp->no = no;
|
||||
sp->type = SPRITE_MSG;
|
||||
sp->show = TRUE;
|
||||
sp->show = true;
|
||||
sp->blendrate = 255;
|
||||
sp->loc.x = x;
|
||||
sp->loc.y = y;
|
||||
@@ -63,7 +62,7 @@ sprite_t *nt_sp_msg_new(int no, int x, int y, int width, int height) {
|
||||
sp->cursize.height = height;
|
||||
sp->u.msg.dspcur.x = 0;
|
||||
sp->u.msg.dspcur.y = 0;
|
||||
sp->u.msg.canvas = sf_create_surface(width, height, sf0->depth);
|
||||
sp->u.msg.canvas = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_ARGB8888);
|
||||
sp->update = ntmsg_update;
|
||||
|
||||
return sp;
|
||||
@@ -77,14 +76,14 @@ void nt_sp_free(sprite_t *sp) {
|
||||
if (sp->cg3) nt_scg_deref(sp->cg3);
|
||||
|
||||
if (sp->type == SPRITE_MSG) {
|
||||
sf_free(sp->u.msg.canvas);
|
||||
SDL_FreeSurface(sp->u.msg.canvas);
|
||||
}
|
||||
|
||||
free(sp);
|
||||
}
|
||||
|
||||
void nt_sp_set_show(sprite_t *sp, boolean show) {
|
||||
boolean oldshow;
|
||||
void nt_sp_set_show(sprite_t *sp, bool show) {
|
||||
bool oldshow;
|
||||
|
||||
if (sp == NULL) return;
|
||||
|
||||
@@ -111,8 +110,8 @@ void nt_sp_set_cg(sprite_t *sp, int no) {
|
||||
sp->cursize.width = 0;
|
||||
sp->cursize.height = 0;
|
||||
} else {
|
||||
sp->cursize.width = cg->sf->width;
|
||||
sp->cursize.height = cg->sf->height;
|
||||
sp->cursize.width = cg->sf->w;
|
||||
sp->cursize.height = cg->sf->h;
|
||||
}
|
||||
|
||||
sp->curcg = cg;
|
||||
|
||||
+21
-24
@@ -3,7 +3,6 @@
|
||||
#define __SPRITE_H__
|
||||
|
||||
#include "portab.h"
|
||||
#include "surface.h"
|
||||
#include "graphics.h"
|
||||
|
||||
#define DEFAULT_UPDATE nt_sp_draw
|
||||
@@ -54,7 +53,7 @@ enum cgtype {
|
||||
struct _cginfo {
|
||||
enum cgtype type; // CGの種類, 0: 未使用, 1:リンクされている, ...
|
||||
int no; // CGの番号
|
||||
surface_t *sf; // CG本体
|
||||
struct SDL_Surface *sf;
|
||||
int refcnt; // 参照カウンタ。0になったら開放してもよい。
|
||||
};
|
||||
typedef struct _cginfo cginfo_t;
|
||||
@@ -78,7 +77,7 @@ struct _sprite {
|
||||
cginfo_t *curcg;
|
||||
cginfo_t *cg1, *cg2, *cg3;
|
||||
|
||||
boolean show;
|
||||
bool show;
|
||||
|
||||
int blendrate;
|
||||
|
||||
@@ -86,7 +85,7 @@ struct _sprite {
|
||||
|
||||
MyPoint cur;
|
||||
|
||||
int (* update)(struct _sprite *sp, MyRectangle *updatearea);
|
||||
void (* update)(struct _sprite *sp, MyRectangle *updatearea);
|
||||
|
||||
union {
|
||||
struct {
|
||||
@@ -97,7 +96,7 @@ struct _sprite {
|
||||
} anime;
|
||||
|
||||
struct {
|
||||
surface_t *canvas;
|
||||
struct SDL_Surface *canvas;
|
||||
MyPoint dspcur;
|
||||
} msg;
|
||||
} u;
|
||||
@@ -107,31 +106,29 @@ typedef struct _sprite sprite_t;
|
||||
|
||||
|
||||
/* in nt_sprite.c */
|
||||
extern sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type);
|
||||
extern sprite_t *nt_sp_msg_new(int no, int x, int y, int width, int height);
|
||||
extern void nt_sp_free(sprite_t *sp);
|
||||
extern void nt_sp_set_show(sprite_t *sp, boolean show);
|
||||
// extern void nt_sp_set_cg(sprite_t *sp, int no);
|
||||
extern void nt_sp_set_loc(sprite_t *sp, int x, int y);
|
||||
sprite_t *nt_sp_new(int no, int cg1, int cg2, int cg3, int type);
|
||||
sprite_t *nt_sp_msg_new(int no, int x, int y, int width, int height);
|
||||
void nt_sp_free(sprite_t *sp);
|
||||
void nt_sp_set_show(sprite_t *sp, bool show);
|
||||
// void nt_sp_set_cg(sprite_t *sp, int no);
|
||||
void nt_sp_set_loc(sprite_t *sp, int x, int y);
|
||||
|
||||
/* in nt_sprite_update.c */
|
||||
extern int nt_sp_update_clipped();
|
||||
extern int nt_sp_update_all(boolean syncscreen);
|
||||
extern int nt_sp_updateme(sprite_t *sp);
|
||||
extern int nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h);
|
||||
extern void nt_sp_add_updatelist(sprite_t *sp);
|
||||
extern void nt_sp_remove_updatelist(sprite_t *sp);
|
||||
extern int nt_sp_draw_wall(sprite_t *sp, MyRectangle *r);
|
||||
extern void nt_sp_clear_updatelist(void);
|
||||
void nt_sp_update_clipped();
|
||||
void nt_sp_update_all(bool syncscreen);
|
||||
void nt_sp_updateme(sprite_t *sp);
|
||||
void nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h);
|
||||
void nt_sp_add_updatelist(sprite_t *sp);
|
||||
void nt_sp_remove_updatelist(sprite_t *sp);
|
||||
void nt_sp_draw_wall(sprite_t *sp, MyRectangle *r);
|
||||
void nt_sp_clear_updatelist(void);
|
||||
|
||||
/* in nt_sprite_draw.c */
|
||||
extern int nt_sp_draw(sprite_t *sp, MyRectangle *r);
|
||||
extern int nt_sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r);
|
||||
extern void nt_sp_draw_dmap(void* data, void* userdata);
|
||||
extern int nt_sp_draw_scg(sprite_t *sp, MyRectangle *r);
|
||||
void nt_sp_draw(sprite_t *sp, MyRectangle *r);
|
||||
void nt_sp_draw_scg(sprite_t *sp, MyRectangle *r);
|
||||
|
||||
/* in nt_sprite_eupdate.c */
|
||||
extern int nt_sp_eupdate(int type, int time, int cancel);
|
||||
void nt_sp_eupdate(int type, int time, int cancel);
|
||||
|
||||
|
||||
#endif /* __SPRITE_H__ */
|
||||
|
||||
@@ -24,13 +24,12 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "ags.h"
|
||||
#include "graphics.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "sprite.h"
|
||||
|
||||
/*
|
||||
@@ -38,106 +37,60 @@
|
||||
@param sp: 描画するスプライト
|
||||
@param r : 再描画する領域
|
||||
*/
|
||||
int nt_sp_draw(sprite_t *sp, MyRectangle *r) {
|
||||
if (sp == NULL) return NG;
|
||||
|
||||
return nt_sp_draw2(sp, sp->curcg, r);
|
||||
}
|
||||
|
||||
/*
|
||||
指定の spriteの指定のCGを surface0 に書く
|
||||
(このインターフェイスはもう不要?)
|
||||
|
||||
@param sp: 描画するスプライト
|
||||
@param cg: 描画するCG
|
||||
@param r : 再描画する領域
|
||||
*/
|
||||
int nt_sp_draw2(sprite_t *sp, cginfo_t *cg, MyRectangle *r) {
|
||||
surface_t update;
|
||||
int sx, sy, w, h, dx, dy;
|
||||
|
||||
if (cg == NULL) return NG;
|
||||
if (cg->sf == NULL) return NG;
|
||||
void nt_sp_draw(sprite_t *sp, MyRectangle *r) {
|
||||
if (sp == NULL) return;
|
||||
cginfo_t *cg = sp->curcg;
|
||||
if (cg == NULL) return;
|
||||
if (cg->sf == NULL) return;
|
||||
|
||||
// 更新領域の確定
|
||||
update.width = r->w;
|
||||
update.height = r->h;
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
dx = sp->cur.x - r->x;
|
||||
dy = sp->cur.y - r->y;
|
||||
w = cg->sf->width;
|
||||
h = cg->sf->height;
|
||||
SDL_Rect cg_rect = {0, 0, cg->sf->w, cg->sf->h};
|
||||
int sx = 0;
|
||||
int sy = 0;
|
||||
int dx = sp->cur.x;
|
||||
int dy = sp->cur.y;
|
||||
int w = cg->sf->w;
|
||||
int h = cg->sf->h;
|
||||
|
||||
if (!gr_clip(cg->sf, &sx, &sy, &w, &h, &update, &dx, &dy)) {
|
||||
return NG;
|
||||
if (!ags_clipCopyRect(&cg_rect, r, &sx, &sy, &dx, &dy, &w, &h)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dx += r->x;
|
||||
dy += r->y;
|
||||
|
||||
if (cg->sf->alpha) {
|
||||
// alpha map がある場合
|
||||
gre_BlendUseAMap(sf0, dx, dy,
|
||||
sf0, dx, dy,
|
||||
cg->sf, sx, sy, w, h,
|
||||
cg->sf, sx, sy,
|
||||
sp->blendrate);
|
||||
|
||||
if (SDL_ISPIXELFORMAT_ALPHA(cg->sf->format->format) || sp->blendrate < 255) {
|
||||
SDL_SetSurfaceBlendMode(cg->sf, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetSurfaceAlphaMod(cg->sf, sp->blendrate);
|
||||
} else {
|
||||
if (sp->blendrate == 255) {
|
||||
// alpha値指定が無い場合
|
||||
gr_copy(sf0, dx, dy, cg->sf, sx, sy, w, h);
|
||||
} else if (sp->blendrate > 0) {
|
||||
// alpha値指定がある場合
|
||||
gre_Blend(sf0, dx, dy,
|
||||
sf0, dx, dy,
|
||||
cg->sf, sx, sy, w, h,
|
||||
sp->blendrate);
|
||||
}
|
||||
SDL_SetSurfaceBlendMode(cg->sf, SDL_BLENDMODE_NONE);
|
||||
}
|
||||
SDL_BlitSurface(cg->sf, &(SDL_Rect){sx, sy, w, h}, main_surface, &(SDL_Rect){dx, dy, w, h});
|
||||
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d",
|
||||
sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// BlendScreenによる描画
|
||||
int nt_sp_draw_scg(sprite_t *sp, MyRectangle *r) {
|
||||
surface_t update;
|
||||
cginfo_t *cg;
|
||||
int sx, sy, w, h, dx, dy;
|
||||
|
||||
if (sp == NULL) return NG;
|
||||
|
||||
cg = sp->curcg;
|
||||
|
||||
if (cg == NULL) return NG;
|
||||
if (cg->sf == NULL) return NG;
|
||||
void nt_sp_draw_scg(sprite_t *sp, MyRectangle *r) {
|
||||
if (sp == NULL) return;
|
||||
cginfo_t *cg = sp->curcg;
|
||||
if (cg == NULL) return;
|
||||
if (cg->sf == NULL) return;
|
||||
|
||||
// 更新領域の確定
|
||||
update.width = r->w;
|
||||
update.height = r->h;
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
dx = sp->cur.x - r->x;
|
||||
dy = sp->cur.y - r->y;
|
||||
w = cg->sf->width;
|
||||
h = cg->sf->height;
|
||||
SDL_Rect cg_rect = {0, 0, cg->sf->w, cg->sf->h};
|
||||
int sx = 0;
|
||||
int sy = 0;
|
||||
int dx = sp->cur.x;
|
||||
int dy = sp->cur.y;
|
||||
int w = cg->sf->w;
|
||||
int h = cg->sf->h;
|
||||
|
||||
if (!gr_clip(cg->sf, &sx, &sy, &w, &h, &update, &dx, &dy)) {
|
||||
return NG;
|
||||
if (!ags_clipCopyRect(&cg_rect, r, &sx, &sy, &dx, &dy, &w, &h)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dx += r->x;
|
||||
dy += r->y;
|
||||
|
||||
gre_BlendScreen(sf0, dx, dy,
|
||||
sf0, dx, dy,
|
||||
cg->sf, sx, sy, w, h);
|
||||
SDL_SetSurfaceBlendMode(cg->sf, SDL_BLENDMODE_ADD);
|
||||
SDL_BlitSurface(cg->sf, &(SDL_Rect){sx, sy, w, h}, main_surface, &(SDL_Rect){dx, dy, w, h});
|
||||
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d",
|
||||
sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "ngraph.h"
|
||||
#include "ags.h"
|
||||
#include "input.h"
|
||||
#include "sprite.h"
|
||||
@@ -37,20 +36,20 @@
|
||||
@param time: 実行時間(msec)
|
||||
@param cancel: キー抜け(0:なし, 1:あり)
|
||||
*/
|
||||
int nt_sp_eupdate(int no, int time, int cancel) {
|
||||
void nt_sp_eupdate(int no, int time, int cancel) {
|
||||
if (no == 1013) {
|
||||
nt_sp_update_all(TRUE);
|
||||
return OK;
|
||||
nt_sp_update_all(true);
|
||||
return;
|
||||
}
|
||||
|
||||
nt_sp_update_all(FALSE);
|
||||
nt_sp_update_all(false);
|
||||
|
||||
enum sdl_effect_type type = from_sact_effect(no - 100);
|
||||
if (type == EFFECT_INVALID) {
|
||||
WARNING("Unimplemented effect %d", no);
|
||||
type = EFFECT_CROSSFADE;
|
||||
}
|
||||
SDL_Rect rect = { 0, 0, sf0->width, sf0->height };
|
||||
SDL_Rect rect = { 0, 0, main_surface->w, main_surface->h };
|
||||
struct sdl_effect *eff = sdl_effect_init(&rect, NULL, 0, 0, sdl_getDIB(), 0, 0, type);
|
||||
|
||||
int sttime, curtime;
|
||||
@@ -66,5 +65,4 @@ int nt_sp_eupdate(int no, int time, int cancel) {
|
||||
}
|
||||
sdl_effect_finish(eff);
|
||||
ags_updateFull();
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -25,15 +25,13 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "list.h"
|
||||
#include "ags.h"
|
||||
#include "graphics.h"
|
||||
// #include "sact.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "sprite.h"
|
||||
|
||||
// スプライト再描画間の間に変更のあったスプライトの領域の和
|
||||
@@ -57,7 +55,7 @@ static void disjunction(void* region, void* data) {
|
||||
// 更新の必要なスプライトの領域の和をとってクリッピングする
|
||||
static MyRectangle get_updatearea() {
|
||||
MyRectangle clip = {0, 0, 0, 0};
|
||||
MyRectangle rsf0 = {0, 0, sf0->width, sf0->height};
|
||||
MyRectangle screen = {0, 0, main_surface->w, main_surface->h};
|
||||
MyRectangle result;
|
||||
|
||||
slist_foreach(updatearea, disjunction, &clip);
|
||||
@@ -66,7 +64,7 @@ static MyRectangle get_updatearea() {
|
||||
updatearea = NULL;
|
||||
|
||||
// surface0との領域の積をとる
|
||||
SDL_IntersectRect(&rsf0, &clip, &result);
|
||||
SDL_IntersectRect(&screen, &clip, &result);
|
||||
|
||||
SACT_DEBUG("clipped area x=%d y=%d w=%d h=%d",
|
||||
result.x, result.y, result.w, result.h);
|
||||
@@ -92,9 +90,9 @@ static void do_update_each(void* data, void* userdata) {
|
||||
画面全体の更新
|
||||
@param syncscreen: surface0 に描画したものを Screen に反映させるかどうか
|
||||
*/
|
||||
int nt_sp_update_all(boolean syncscreen) {
|
||||
void nt_sp_update_all(bool syncscreen) {
|
||||
// 画面全体を更新領域に
|
||||
MyRectangle r = {0, 0, sf0->width, sf0->height };
|
||||
MyRectangle r = {0, 0, main_surface->w, main_surface->h };
|
||||
|
||||
// updatelistに登録してあるスプライトを再描画
|
||||
// updatelistはスプライトの番号順に並んでいる
|
||||
@@ -106,41 +104,37 @@ int nt_sp_update_all(boolean syncscreen) {
|
||||
if (syncscreen) {
|
||||
ags_updateFull();
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
画面の一部を更新
|
||||
updateme(_part)で登録した更新が必要なspriteの和の領域をupdate
|
||||
*/
|
||||
int nt_sp_update_clipped() {
|
||||
void nt_sp_update_clipped() {
|
||||
MyRectangle r;
|
||||
|
||||
// 更新領域の確定
|
||||
r = get_updatearea();
|
||||
|
||||
if (SDL_RectEmpty(&r))
|
||||
return OK;
|
||||
return;
|
||||
|
||||
// 更新領域に入っているスプライトの再描画
|
||||
slist_foreach(updatelist, do_update_each, &r);
|
||||
|
||||
// 更新領域を Window に転送
|
||||
ags_updateArea(r.x, r.y, r.w, r.h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
sprite全体の更新を登録
|
||||
@param sp: 更新するスプライト
|
||||
*/
|
||||
int nt_sp_updateme(sprite_t *sp) {
|
||||
void nt_sp_updateme(sprite_t *sp) {
|
||||
MyRectangle *r;
|
||||
|
||||
if (sp == NULL) return NG;
|
||||
if (sp->cursize.width == 0 || sp->cursize.height == 0) return NG;
|
||||
if (sp == NULL) return;
|
||||
if (sp->cursize.width == 0 || sp->cursize.height == 0) return;
|
||||
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r->x = sp->cur.x;
|
||||
@@ -152,8 +146,6 @@ int nt_sp_updateme(sprite_t *sp) {
|
||||
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d",
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -164,11 +156,11 @@ int nt_sp_updateme(sprite_t *sp) {
|
||||
@param w: 更新領域幅
|
||||
@param h: 更新領域高さ
|
||||
*/
|
||||
int nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
void nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
MyRectangle *r;
|
||||
|
||||
if (sp == NULL) return NG;
|
||||
if (w == 0 || h == 0) return NG;
|
||||
if (sp == NULL) return;
|
||||
if (w == 0 || h == 0) return;
|
||||
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r->x = sp->cur.x + x;
|
||||
@@ -180,8 +172,6 @@ int nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d",
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// スプライトの番号順に更新するためにリストに順番に要れるためのcallbck
|
||||
@@ -214,18 +204,6 @@ void nt_sp_clear_updatelist(void) {
|
||||
}
|
||||
|
||||
// デフォルトの壁紙update
|
||||
int nt_sp_draw_wall(sprite_t *sp, MyRectangle *area) {
|
||||
int sx, sy, w, h;
|
||||
|
||||
sx = area->x;
|
||||
sy = area->y;
|
||||
w = area->w;
|
||||
h = area->h;
|
||||
gr_fill(sf0, sx, sy, w, h, 0, 0, 0);
|
||||
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d",
|
||||
sp->no, sx, sy, w, h);
|
||||
|
||||
return OK;
|
||||
void nt_sp_draw_wall(sprite_t *sp, MyRectangle *area) {
|
||||
SDL_FillRect(main_surface, area, SDL_MapRGB(main_surface->format, 0, 0, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "music.h"
|
||||
#include "sdl_core.h"
|
||||
#include "input.h"
|
||||
#include "ngraph.h"
|
||||
#include "cg.h"
|
||||
#include "jpeg.h"
|
||||
|
||||
@@ -51,7 +50,7 @@ static void ndd_run(int demonum) {
|
||||
|
||||
int mus = ndemo_mus[demonum];
|
||||
if (mus)
|
||||
musbgm_play(mus, 0, 100);
|
||||
musbgm_play(mus, 0, 100, 0);
|
||||
|
||||
uint32_t start = sdl_getTicks();
|
||||
while (!nact->is_quit) {
|
||||
@@ -61,8 +60,10 @@ static void ndd_run(int demonum) {
|
||||
|
||||
cgdata *cg = jpeg_extract(alk->entries[i].data, alk->entries[i].size);
|
||||
if (cg) {
|
||||
gr_drawimage24(sf0, cg, 0, 0);
|
||||
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormatFrom(cg->pic, cg->width, cg->height, 24, cg->width * 3, SDL_PIXELFORMAT_RGB24);
|
||||
SDL_BlitSurface(sf, NULL, main_surface, NULL);
|
||||
ags_updateFull();
|
||||
SDL_FreeSurface(sf);
|
||||
cgdata_free(cg);
|
||||
} else {
|
||||
WARNING("Cannot decode CG %d in %s", i, alk_path);
|
||||
@@ -93,7 +94,7 @@ static void Init() {
|
||||
|
||||
*var = 1;
|
||||
|
||||
DEBUG_COMMAND("NightDemonDemo.Init %d,%d,%d,%p:", p1, p2, p3, var);
|
||||
TRACE("NightDemonDemo.Init %d,%d,%d,%p:", p1, p2, p3, var);
|
||||
}
|
||||
|
||||
static void Run() {
|
||||
@@ -102,7 +103,7 @@ static void Run() {
|
||||
|
||||
ndd_run(p1);
|
||||
|
||||
DEBUG_COMMAND("NightDemonDemo.Run %d,%d:", p1, p2);
|
||||
TRACE("NightDemonDemo.Run %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
@@ -40,7 +40,7 @@ static void Init() {
|
||||
*/
|
||||
int p1 = getCaliValue(); /* ITimer */
|
||||
|
||||
DEBUG_COMMAND_YET("RandMT.Init %p:", p1);
|
||||
TRACE_UNIMPLEMENTED("RandMT.Init %p:", p1);
|
||||
}
|
||||
|
||||
static void Get() {
|
||||
@@ -59,7 +59,7 @@ static void Get() {
|
||||
*var = (int)(genrand() * num) + 1;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("RandMT.Get %d,%p:", num, var);
|
||||
TRACE("RandMT.Get %d,%p:", num, var);
|
||||
}
|
||||
|
||||
static void GetNoOverlap() {
|
||||
@@ -69,7 +69,7 @@ static void GetNoOverlap() {
|
||||
|
||||
*var = (int)(genrand() * n) + min;
|
||||
|
||||
DEBUG_COMMAND("RandMT.GetNoOverlap %d,%d,%p:", min, n, var);
|
||||
TRACE("RandMT.GetNoOverlap %d,%d,%p:", min, n, var);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
* Copyright (C) 2025 <KichikuouChrome@gmail.com>
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "modules.h"
|
||||
#include "nact.h"
|
||||
#include "bgm.h"
|
||||
#include "music.h"
|
||||
#include "music_pcm.h"
|
||||
|
||||
#define SLOT 128
|
||||
|
||||
static int current_no = 0;
|
||||
|
||||
static void Init(void) {
|
||||
int isys3x = getCaliValue();
|
||||
TRACE("S3xMusic.Init %d:", isys3x);
|
||||
}
|
||||
|
||||
static void CreateChannel(void) {
|
||||
int nr_channels = getCaliValue();
|
||||
if (nr_channels != 2)
|
||||
SYSERROR("Unsupported number of channels: %d", nr_channels);
|
||||
TRACE("S3xMusic.CreateChannel %d:", nr_channels);
|
||||
}
|
||||
|
||||
static void Prepare(void) {
|
||||
int ch = getCaliValue();
|
||||
int no = getCaliValue();
|
||||
int *result = getCaliVariable();
|
||||
|
||||
if (ch == 0) {
|
||||
current_no = no;
|
||||
*result = 1;
|
||||
} else {
|
||||
*result = muspcm_load_bgm(SLOT, no) ? 1 : 0;
|
||||
}
|
||||
TRACE("S3xMusic.Prepare %d, %d => %d:", ch, no, *result);
|
||||
}
|
||||
|
||||
static void Unprepare(void) {
|
||||
int ch = getCaliValue();
|
||||
|
||||
if (ch == 0) {
|
||||
if (current_no) {
|
||||
musbgm_stop(current_no, 0);
|
||||
current_no = 0;
|
||||
}
|
||||
} else {
|
||||
muspcm_unload(SLOT);
|
||||
}
|
||||
TRACE("S3xMusic.Unprepare %d:", ch);
|
||||
}
|
||||
|
||||
static void Play(void) {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.Play %d, %d:", p1, p2);
|
||||
}
|
||||
|
||||
static void FadePlay(void) {
|
||||
int ch = getCaliValue();
|
||||
int fadein_time = getCaliValue();
|
||||
int volume = getCaliValue();
|
||||
int loop_count = getCaliValue(); // 0 = infinite
|
||||
|
||||
if (ch == 0) {
|
||||
musbgm_play(current_no, fadein_time, volume, loop_count);
|
||||
} else {
|
||||
muspcm_start(SLOT, loop_count == 0 ? -1 : loop_count);
|
||||
}
|
||||
TRACE("S3xMusic.FadePlay %d, %d, %d, %d:", ch, fadein_time, volume, loop_count);
|
||||
}
|
||||
|
||||
static void PlayPosSample(void) {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.PlayPosSample %d, %d, %d, %d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void IsPlay(void) {
|
||||
int ch = getCaliValue();
|
||||
int *result = getCaliVariable();
|
||||
|
||||
if (ch == 0) {
|
||||
*result = current_no && musbgm_isplaying(current_no);
|
||||
} else {
|
||||
*result = muspcm_isplaying(SLOT);
|
||||
}
|
||||
TRACE("S3xMusic.IsPlay %d => %d:", ch, *result);
|
||||
}
|
||||
|
||||
static void Stop(void) {
|
||||
int ch = getCaliValue();
|
||||
|
||||
if (ch == 0) {
|
||||
if (current_no)
|
||||
musbgm_stop(current_no, 0);
|
||||
current_no = 0;
|
||||
} else {
|
||||
muspcm_stop(SLOT);
|
||||
}
|
||||
TRACE("S3xMusic.Stop %d:", ch);
|
||||
}
|
||||
|
||||
static void Restart(void) {
|
||||
int p1 = getCaliValue();
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.Restart %d:", p1);
|
||||
}
|
||||
|
||||
static void GetPlayPos(void) {
|
||||
int ch = getCaliValue();
|
||||
int *hour = getCaliVariable();
|
||||
int *min = getCaliVariable();
|
||||
int *sec = getCaliVariable();
|
||||
int *msec = getCaliVariable();
|
||||
if (ch == 0) {
|
||||
int time = musbgm_getpos(current_no);
|
||||
*hour = time / 360000;
|
||||
*min = (time / 6000) % 60;
|
||||
*sec = (time / 100) % 60;
|
||||
*msec = (time % 100) * 10;
|
||||
} else {
|
||||
// not implemented
|
||||
*hour = 0;
|
||||
*min = 0;
|
||||
*sec = 0;
|
||||
*msec = 0;
|
||||
}
|
||||
TRACE("S3xMusic.GetPlayPos %d => %d, %d, %d, %d:", ch, *hour, *min, *sec, *msec);
|
||||
}
|
||||
|
||||
static void GetPlayPosSample(void) {
|
||||
int p1 = getCaliValue();
|
||||
int *var1 = getCaliVariable();
|
||||
int *var2 = getCaliVariable();
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.GetPlayPosSample %d, %p, %p:", p1, var1, var2);
|
||||
}
|
||||
|
||||
static void SetRepeatStart(void) {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.SetRepeatStart %d, %d, %d:", p1, p2, p3);
|
||||
}
|
||||
|
||||
static void SetRepeatEnd(void) {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.SetRepeatEnd %d, %d, %d:", p1, p2, p3);
|
||||
}
|
||||
|
||||
static void FadeVolume(void) {
|
||||
int ch = getCaliValue();
|
||||
int time = getCaliValue();
|
||||
int volume = getCaliValue();
|
||||
int stop_after_fade = getCaliValue();
|
||||
|
||||
if (ch == 0) {
|
||||
if (stop_after_fade) {
|
||||
musbgm_stop(current_no, time / 10);
|
||||
} else {
|
||||
musbgm_fade(current_no, time / 10, volume);
|
||||
}
|
||||
} else {
|
||||
if (stop_after_fade) {
|
||||
muspcm_fadeout(SLOT, time);
|
||||
} else {
|
||||
muspcm_setvol(SLOT, volume);
|
||||
}
|
||||
}
|
||||
TRACE("S3xMusic.FadeVolume %d, %d, %d, %d:", ch, time, volume, stop_after_fade);
|
||||
}
|
||||
|
||||
static void IsFade(void) {
|
||||
int ch = getCaliValue();
|
||||
int *result = getCaliVariable();
|
||||
*result = 0;
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.IsFade %d => %d:", ch, *result);
|
||||
}
|
||||
|
||||
static void StopFade(void) {
|
||||
int ch = getCaliValue();
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.StopFade %d:", ch);
|
||||
}
|
||||
|
||||
static void WaitEnd(void) {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue(); // IWinMsg
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.WaitEnd %d, %d:", p1, p2);
|
||||
}
|
||||
|
||||
static void sleep(void) {
|
||||
int p1 = getCaliValue(); // IWinMsg
|
||||
TRACE_UNIMPLEMENTED("S3xMusic.sleep %d:", p1);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"CreateChannel", CreateChannel},
|
||||
{"FadePlay", FadePlay},
|
||||
{"FadeVolume", FadeVolume},
|
||||
{"GetPlayPos", GetPlayPos},
|
||||
{"GetPlayPosSample", GetPlayPosSample},
|
||||
{"Init", Init},
|
||||
{"IsFade", IsFade},
|
||||
{"IsPlay", IsPlay},
|
||||
{"Play", Play},
|
||||
{"PlayPosSample", PlayPosSample},
|
||||
{"Prepare", Prepare},
|
||||
{"Restart", Restart},
|
||||
{"SetRepeatEnd", SetRepeatEnd},
|
||||
{"SetRepeatStart", SetRepeatStart},
|
||||
{"Stop", Stop},
|
||||
{"StopFade", StopFade},
|
||||
{"Unprepare", Unprepare},
|
||||
{"WaitEnd", WaitEnd},
|
||||
{"sleep", sleep},
|
||||
};
|
||||
|
||||
const Module module_S3xMusic = {"S3xMusic", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
+154
-156
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -29,7 +29,7 @@
|
||||
#include "portab.h"
|
||||
#include "list.h"
|
||||
#include "graphics.h"
|
||||
#include "surface.h"
|
||||
#include "ags.h"
|
||||
#include "sacttimer.h"
|
||||
#include "variable.h"
|
||||
|
||||
@@ -73,7 +73,7 @@ enum cgtype {
|
||||
struct _cginfo {
|
||||
enum cgtype type; // CGの種類, 0: 未使用, 1:リンクされている, ...
|
||||
int no; // CGの番号
|
||||
surface_t *sf; // CG本体
|
||||
struct SDL_Surface *sf;
|
||||
int refcnt; // 参照カウンタ。0になったら開放してもよい。
|
||||
};
|
||||
typedef struct _cginfo cginfo_t;
|
||||
@@ -116,8 +116,8 @@ struct _sprite {
|
||||
cginfo_t *curcg;
|
||||
|
||||
// スプライトを表示するか
|
||||
boolean show;
|
||||
boolean show_save; // Zkey hide save用
|
||||
bool show;
|
||||
bool show_save; // Zkey hide save用
|
||||
|
||||
// 表示する際のブレンド率 0:全く見えない, 255: 通常表示
|
||||
int blendrate;
|
||||
@@ -137,10 +137,10 @@ struct _sprite {
|
||||
// sprite削除時の callback
|
||||
void (* remove)(struct _sprite *sp);
|
||||
// spriteを再描画するときの callback
|
||||
int (* update)(struct _sprite *sp);
|
||||
void (* update)(struct _sprite *sp);
|
||||
|
||||
boolean focused; // forcusを得ているか
|
||||
boolean pressed; // このsprite上でマウスが押されているか
|
||||
bool focused; // forcusを得ているか
|
||||
bool pressed; // このsprite上でマウスが押されているか
|
||||
|
||||
SList *expsp; // 説明スプライトのリスト
|
||||
|
||||
@@ -151,7 +151,7 @@ struct _sprite {
|
||||
int speed; // 移動速度
|
||||
int starttime; // 移動開始時刻
|
||||
int endtime; // 移動終了予定時刻
|
||||
boolean moving; // 移動中かどうか
|
||||
bool moving; // 移動中かどうか
|
||||
} move;
|
||||
|
||||
// SACT.Numeral用パラメータ
|
||||
@@ -170,7 +170,7 @@ struct _sprite {
|
||||
|
||||
// ゲットスプライト
|
||||
struct {
|
||||
boolean dragging; // ドラッグ中
|
||||
bool dragging; // ドラッグ中
|
||||
MyPoint dragstart; // ドラッグ開始位置
|
||||
} get;
|
||||
|
||||
@@ -190,7 +190,7 @@ struct _sprite {
|
||||
// メッセージスプライト
|
||||
struct {
|
||||
SList *buf; // 表示する文字のリスト
|
||||
surface_t *canvas; // 文字を描画するsurface
|
||||
struct SDL_Surface *canvas;
|
||||
MyPoint dspcur; // 現在の表示位置
|
||||
} msg;
|
||||
} u;
|
||||
@@ -234,7 +234,7 @@ struct _sact {
|
||||
int align; // 行そろえ
|
||||
void (* cbmove)(agsevent_t *);
|
||||
void (* cbrelease)(agsevent_t *);
|
||||
surface_t *charcanvas;
|
||||
struct SDL_Surface *charcanvas;
|
||||
} sel;
|
||||
|
||||
// event listener
|
||||
@@ -254,7 +254,7 @@ struct _sact {
|
||||
|
||||
// DnDに関するもの
|
||||
sprite_t *draggedsp; // drag中のスプライト
|
||||
boolean dropped; // スプライトがドロップされたかどうか
|
||||
bool dropped; // スプライトがドロップされたかどうか
|
||||
|
||||
// keywaitの種類
|
||||
int waittype;
|
||||
@@ -273,14 +273,14 @@ struct _sact {
|
||||
int numsoundob;
|
||||
|
||||
// depth map
|
||||
surface_t *dmap;
|
||||
struct SDL_Surface *dmap;
|
||||
|
||||
boolean zhiding; // Zkeyによる隠し中
|
||||
bool zhiding; // Zkeyによる隠し中
|
||||
int zofftime;
|
||||
boolean zdooff;
|
||||
bool zdooff;
|
||||
|
||||
// バックログ
|
||||
boolean logging;
|
||||
bool logging;
|
||||
List *log;
|
||||
};
|
||||
typedef struct _sact sact_t;
|
||||
|
||||
+21
-82
@@ -25,23 +25,18 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "LittleEndian.h"
|
||||
#include "input.h"
|
||||
#include "ags.h"
|
||||
#include "sact.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "pms.h"
|
||||
#include "sprite.h"
|
||||
#include "sdl_core.h"
|
||||
#include "mmap.h"
|
||||
|
||||
static surface_t *smask_get(int no);
|
||||
static surface_t *smask_mul(surface_t *sf, int val);
|
||||
|
||||
// SACTEFAM を使ったマスク
|
||||
typedef struct {
|
||||
mmap_t *mmap;
|
||||
@@ -52,24 +47,14 @@ typedef struct {
|
||||
|
||||
static SACTEFAM_t am;
|
||||
|
||||
struct ecopyparam {
|
||||
int sttime;
|
||||
int curtime;
|
||||
int edtime;
|
||||
int curstep;
|
||||
int oldstep;
|
||||
};
|
||||
typedef struct ecopyparam ecopyparam_t;
|
||||
static ecopyparam_t ecp;
|
||||
|
||||
// SACTEFAM.KLD の読み込み
|
||||
int smask_init(char *path) {
|
||||
bool smask_init(char *path) {
|
||||
if (am.mmap)
|
||||
return OK; // already loaded
|
||||
return true; // already loaded
|
||||
|
||||
mmap_t *m = map_file(path);
|
||||
if (!m)
|
||||
return NG;
|
||||
return false;
|
||||
am.mmap = m;
|
||||
am.datanum = LittleEndian_getDW(m->addr, 0);
|
||||
am.no = malloc(sizeof(int) * am.datanum);
|
||||
@@ -80,11 +65,11 @@ int smask_init(char *path) {
|
||||
am.offset[i] = LittleEndian_getDW(m->addr, 16 + i * 16 + 8);
|
||||
}
|
||||
|
||||
return OK;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 指定番号の alphamask ファイルをよみだす
|
||||
static surface_t *smask_get(int no) {
|
||||
static cgdata *smask_get(int no) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < am.datanum; i++) {
|
||||
@@ -93,71 +78,25 @@ static surface_t *smask_get(int no) {
|
||||
|
||||
if (i == am.datanum) return NULL;
|
||||
|
||||
return sf_getcg(am.mmap->addr + am.offset[i], 0 /*FIXME*/);
|
||||
}
|
||||
|
||||
// ベースになるマスクの alpha 値を拡大して取り出す
|
||||
static surface_t *smask_mul(surface_t *sf, int val) {
|
||||
surface_t *out = sf_create_alpha(sf->width, sf->height);
|
||||
uint8_t *src = sf->alpha;
|
||||
uint8_t *dst = out->alpha;
|
||||
int pix = sf->width * sf->height;
|
||||
|
||||
while(pix--) {
|
||||
int i = (*src - val) * 16;
|
||||
if (i < 0) *dst = 255; // 指定値よりも大きいのはコピー
|
||||
else if (i > 255) *dst = 0; // 指定値よりも小さいのは無視
|
||||
else *dst = 255-i; // それ以外は値を16倍
|
||||
src++; dst++;
|
||||
}
|
||||
|
||||
return out;
|
||||
return pms256_extract(am.mmap->addr + am.offset[i]);
|
||||
}
|
||||
|
||||
/**
|
||||
* マスクつき画面更新
|
||||
*/
|
||||
int sp_eupdate_amap(int index, int time, int cancel) {
|
||||
surface_t *mask, *mask2;
|
||||
surface_t *sfsrc, *sfdst;
|
||||
int key;
|
||||
|
||||
mask = smask_get(index);
|
||||
void sp_eupdate_amap(int index, int time, int cancel) {
|
||||
cgdata *mask = smask_get(index);
|
||||
if (mask == NULL) {
|
||||
sp_update_all(TRUE);
|
||||
return OK;
|
||||
sp_update_all(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// 現在の sf0 をセーブ
|
||||
sfsrc = sf_dup(sf0);
|
||||
sp_update_all(FALSE);
|
||||
sfdst = sf_dup(sf0);
|
||||
sf_copyall(sf0, sfsrc);
|
||||
|
||||
ecp.sttime = ecp.curtime = sdl_getTicks();
|
||||
ecp.edtime = ecp.curtime + time*10;
|
||||
ecp.oldstep = 0;
|
||||
|
||||
while ((ecp.curtime = sdl_getTicks()) < ecp.edtime) {
|
||||
int curstep = 255 * (ecp.curtime - ecp.sttime)/ (ecp.edtime - ecp.sttime);
|
||||
// 元になるマスクのalpha値を16倍して欲しいところだけ取り出す
|
||||
mask2 = smask_mul(mask, curstep);
|
||||
|
||||
gre_BlendUseAMap(sf0, 0, 0, sfsrc, 0, 0, sfdst, 0, 0, sfsrc->width, sfsrc->height, mask2, 0, 0, 255);
|
||||
ags_updateFull();
|
||||
|
||||
key = sys_keywait(10, cancel ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE);
|
||||
if (cancel && key) break;
|
||||
|
||||
// 一時マスクを削除
|
||||
sf_free(mask2);
|
||||
}
|
||||
|
||||
sf_copyall(sf0, sfdst);
|
||||
SDL_Surface *mask_sf = SDL_CreateRGBSurfaceFrom(mask->pic, mask->width, mask->height, 8, mask->width, 0, 0, 0, 0);
|
||||
sp_update_all(false); // old = sdl_texture, new = main_surface
|
||||
struct sdl_effect *eff = sdl_effect_sactamask_init(mask_sf);
|
||||
ags_runEffect(time * 10, cancel, (ags_EffectStepFunc)sdl_effect_step, eff);
|
||||
sdl_effect_finish(eff);
|
||||
ags_updateFull();
|
||||
sf_free(sfsrc);
|
||||
sf_free(sfdst);
|
||||
|
||||
sf_free(mask);
|
||||
return OK;
|
||||
|
||||
SDL_FreeSurface(mask_sf);
|
||||
cgdata_free(mask);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#ifndef __SACTAMASK_H__
|
||||
#define __SACTAMASK_H__
|
||||
|
||||
extern int smask_init(const char *path);
|
||||
bool smask_init(const char *path);
|
||||
void sp_eupdate_amap(int type, int time, int key);
|
||||
|
||||
#endif
|
||||
|
||||
+143
-132
@@ -23,9 +23,11 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "nact.h"
|
||||
@@ -33,19 +35,16 @@
|
||||
#include "ags.h"
|
||||
#include "sact.h"
|
||||
#include "sactcg.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "cg.h"
|
||||
#include "sdl_core.h"
|
||||
|
||||
#include "sactcg_stretch.c"
|
||||
#include "sactcg_blend.c"
|
||||
|
||||
#define spcg_assert_no(no) \
|
||||
#define SPCG_ASSERT_NO(no) \
|
||||
if ((no) > (CGMAX -1)) { \
|
||||
WARNING("no is too large (should be %d < %d)", (no), CGMAX); \
|
||||
return NG; \
|
||||
return; \
|
||||
} \
|
||||
|
||||
static cginfo_t *scg_new(enum cgtype type, int no, surface_t *sf) {
|
||||
static cginfo_t *scg_new(enum cgtype type, int no, SDL_Surface *sf) {
|
||||
cginfo_t *info = calloc(1, sizeof(cginfo_t));
|
||||
info->type = type;
|
||||
info->no = no;
|
||||
@@ -75,7 +74,7 @@ static cginfo_t *scg_get(int no) {
|
||||
if (sact.cg[no] != NULL)
|
||||
return sact.cg[no];
|
||||
|
||||
surface_t *sf = sf_loadcg_no(no - 1);
|
||||
SDL_Surface *sf = cg_load_as_sdlsurface(no - 1);
|
||||
if (!sf) {
|
||||
WARNING("load fail (%d)", no -1);
|
||||
return NULL;
|
||||
@@ -95,85 +94,137 @@ void scg_deref(cginfo_t *cg) {
|
||||
return;
|
||||
|
||||
if (cg->sf)
|
||||
sf_free(cg->sf);
|
||||
SDL_FreeSurface(cg->sf);
|
||||
free(cg);
|
||||
}
|
||||
|
||||
// 指定の大きさ、色の矩形の CG を作成
|
||||
int scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate) {
|
||||
spcg_assert_no(wNumCG);
|
||||
void scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate) {
|
||||
SPCG_ASSERT_NO(wNumCG);
|
||||
|
||||
surface_t *sf = sf_create_surface(wWidth, wHeight, sf0->depth);
|
||||
gr_fill(sf, 0, 0, wWidth, wHeight, wR, wG, wB);
|
||||
gr_fill_alpha_map(sf, 0, 0, wWidth, wHeight, wBlendRate);
|
||||
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, wWidth, wHeight, 32, SDL_PIXELFORMAT_ARGB8888);
|
||||
SDL_FillRect(sf, NULL, SDL_MapRGBA(sf->format, wR, wG, wB, wBlendRate));
|
||||
scg_new(CG_SET, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定のCGを反転させたCGを作成
|
||||
int scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY) {
|
||||
spcg_assert_no(wNumCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
void scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY) {
|
||||
SPCG_ASSERT_NO(wNumCG);
|
||||
SPCG_ASSERT_NO(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
return;
|
||||
|
||||
surface_t *sf = stretch(src->sf, src->sf->width, src->sf->height, (wReverseX << 1) | wReverseY);
|
||||
SDL_Surface *sf = SDL_ConvertSurface(src->sf, src->sf->format, 0);
|
||||
if (wReverseX)
|
||||
sdl_FlipSurfaceHorizontal(sf);
|
||||
if (wReverseY)
|
||||
sdl_FlipSurfaceVertical(sf);
|
||||
scg_new(CG_REVERSE, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定のCGを拡大/縮小したCGを作成
|
||||
int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) {
|
||||
spcg_assert_no(wNumCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
void scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) {
|
||||
SPCG_ASSERT_NO(wNumCG);
|
||||
SPCG_ASSERT_NO(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
|
||||
surface_t *sf = stretch(src->sf, wWidth, wHeight, 0);
|
||||
return;
|
||||
|
||||
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, wWidth, wHeight, src->sf->format->BitsPerPixel, src->sf->format->format);
|
||||
SDL_BlitScaled(src->sf, NULL, sf, NULL);
|
||||
scg_new(CG_STRETCH, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
static SDL_Surface *blend(SDL_Surface *base, int x, int y, SDL_Surface *blend, int mode) {
|
||||
assert(blend->format->format == SDL_PIXELFORMAT_ARGB8888 || blend->format->format == SDL_PIXELFORMAT_XRGB8888);
|
||||
bool src_has_alpha = SDL_ISPIXELFORMAT_ALPHA(blend->format->format);
|
||||
SDL_Surface *dst = SDL_ConvertSurfaceFormat(base, SDL_PIXELFORMAT_ARGB8888, 0);
|
||||
SDL_Rect rect = {x, y, blend->w, blend->h};
|
||||
SDL_IntersectRect(&(SDL_Rect){0, 0, dst->w, dst->h}, &rect, &rect);
|
||||
|
||||
for (int i = 0; i < rect.h; i++) {
|
||||
uint8_t *dstp = (uint8_t *)dst->pixels + (i + rect.y) * dst->pitch + rect.x * 4;
|
||||
uint8_t *srcp = (uint8_t *)blend->pixels + i * blend->pitch;
|
||||
for (int j = 0; j < rect.w; j++) {
|
||||
uint8_t *dstpp = dstp + j * 4;
|
||||
uint8_t *srcpp = srcp + j * 4;
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
// Use base's alpha map if blend has no alpha map
|
||||
uint8_t alpha = src_has_alpha ? srcpp[3] : dstpp[3];
|
||||
if (alpha == 0) {
|
||||
// do nothing
|
||||
} else if (alpha == 255) {
|
||||
memcpy(dstpp, srcpp, 3);
|
||||
} else {
|
||||
for (int k = 0; k < 3; k++) {
|
||||
dstpp[k] = (dstpp[k] * (255 - alpha) + srcpp[k] * alpha) / 255;
|
||||
}
|
||||
}
|
||||
if (mode) {
|
||||
int dsta = dstpp[3] + srcpp[3];
|
||||
dstpp[3] = dsta > 255 ? 255 : dsta;
|
||||
}
|
||||
#else
|
||||
// Use base's alpha map if blend has no alpha map
|
||||
uint8_t alpha = src_has_alpha ? srcpp[0] : dstpp[0];
|
||||
if (alpha == 0) {
|
||||
// do nothing
|
||||
} else if (alpha == 255) {
|
||||
memcpy(dstpp + 1, srcpp + 1, 3);
|
||||
} else {
|
||||
for (int k = 1; k < 4; k++) {
|
||||
dstpp[k] = (dstpp[k] * (255 - alpha) + srcpp[k] * alpha) / 255;
|
||||
}
|
||||
}
|
||||
if (mode) {
|
||||
int dsta = dstpp[0] + srcpp[0];
|
||||
dstpp[0] = dsta > 255 ? 255 : dsta;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
// ベースCGの上にブレンドCGを重ねた CG を作成
|
||||
int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode) {
|
||||
spcg_assert_no(wNumDstCG);
|
||||
spcg_assert_no(wNumBaseCG);
|
||||
spcg_assert_no(wNumBlendCG);
|
||||
void scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode) {
|
||||
SPCG_ASSERT_NO(wNumDstCG);
|
||||
SPCG_ASSERT_NO(wNumBaseCG);
|
||||
SPCG_ASSERT_NO(wNumBlendCG);
|
||||
|
||||
cginfo_t *basecg = scg_get(wNumBaseCG);
|
||||
cginfo_t *blendcg = scg_get(wNumBlendCG);
|
||||
if (!basecg || !blendcg) return NG;
|
||||
if (!basecg || !blendcg) return;
|
||||
|
||||
surface_t *sf = blend(basecg->sf, wX, wY, blendcg->sf, wAlphaMapMode);
|
||||
SDL_Surface *sf = blend(basecg->sf, wX, wY, blendcg->sf, wAlphaMapMode);
|
||||
scg_new(CG_SET, wNumDstCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定の文字列のCGを作成
|
||||
int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) {
|
||||
spcg_assert_no(wNumCG);
|
||||
void scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText) {
|
||||
SPCG_ASSERT_NO(wNumCG);
|
||||
|
||||
// 勝手に出ていいのかな?
|
||||
if (svar_length(wText) == 0) return OK;
|
||||
if (svar_length(wText) == 0) return;
|
||||
|
||||
ags_setFont(FONT_GOTHIC, wSize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(svar_get(wText));
|
||||
SDL_Surface *glyph = ags_drawStringToSurface(svar_get(wText), wR, wG, wB);
|
||||
|
||||
surface_t *sf = sf_create_surface(glyph->width, wSize, nact->ags.dib->depth);
|
||||
gr_fill(sf, 0, 0, glyph->width, wSize, wR, wG, wB);
|
||||
gr_draw_amap(sf, 0, 0, glyph->pixel, glyph->width, wSize, glyph->bytes_per_line);
|
||||
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, glyph->w, wSize, 32, SDL_PIXELFORMAT_ARGB8888);
|
||||
SDL_SetSurfaceBlendMode(glyph, SDL_BLENDMODE_NONE);
|
||||
SDL_BlitSurface(glyph, NULL, sf, NULL);
|
||||
SDL_FreeSurface(glyph);
|
||||
|
||||
scg_new(CG_SET, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 数字文字列のCGを作成
|
||||
int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue) {
|
||||
spcg_assert_no(wNumCG);
|
||||
void scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue) {
|
||||
SPCG_ASSERT_NO(wNumCG);
|
||||
|
||||
char s[256], ss[256];
|
||||
if (wZeroPadding) {
|
||||
@@ -186,157 +237,117 @@ int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs,
|
||||
sprintf(s, ss, wValue);
|
||||
|
||||
ags_setFont(FONT_GOTHIC, wSize);
|
||||
agsurface_t *glyph = ags_drawStringToSurface(s);
|
||||
SDL_Surface *glyph = ags_drawStringToSurface(s, wR, wG, wB);
|
||||
|
||||
surface_t *sf = sf_create_surface(glyph->width, wSize, nact->ags.dib->depth);
|
||||
gr_fill(sf, 0, 0, glyph->width, wSize, wR, wG, wB);
|
||||
gr_draw_amap(sf, 0, 0, glyph->pixel, glyph->width, wSize, glyph->bytes_per_line);
|
||||
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, glyph->w, wSize, 32, SDL_PIXELFORMAT_ARGB8888);
|
||||
SDL_SetSurfaceBlendMode(glyph, SDL_BLENDMODE_NONE);
|
||||
SDL_BlitSurface(glyph, NULL, sf, NULL);
|
||||
SDL_FreeSurface(glyph);
|
||||
|
||||
scg_new(CG_SET, wNumCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// CGを複製
|
||||
int scg_copy(int wNumDstCG, int wNumSrcCG) {
|
||||
spcg_assert_no(wNumDstCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
void scg_copy(int wNumDstCG, int wNumSrcCG) {
|
||||
SPCG_ASSERT_NO(wNumDstCG);
|
||||
SPCG_ASSERT_NO(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
return;
|
||||
|
||||
scg_new(CG_SET, wNumDstCG, sf_dup(src->sf));
|
||||
return OK;
|
||||
scg_new(CG_SET, wNumDstCG, SDL_ConvertSurface(src->sf, src->sf->format, 0));
|
||||
}
|
||||
|
||||
// CGの一部を切りぬいたCGを作成
|
||||
int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
spcg_assert_no(wNumDstCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
void scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
SPCG_ASSERT_NO(wNumDstCG);
|
||||
SPCG_ASSERT_NO(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
return;
|
||||
|
||||
surface_t *sf = src->sf->alpha
|
||||
? sf_create_surface(wWidth, wHeight, src->sf->depth)
|
||||
: sf_create_pixel(wWidth, wHeight, src->sf->depth);
|
||||
|
||||
if (src->sf->pixel)
|
||||
gr_copy(sf, 0, 0, src->sf, wX, wY, wWidth, wHeight);
|
||||
if (src->sf->alpha)
|
||||
gr_copy_alpha_map(sf, 0, 0, src->sf, wX, wY, wWidth, wHeight);
|
||||
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, wWidth, wHeight, src->sf->format->BitsPerPixel, src->sf->format->format);
|
||||
SDL_BlitSurface(src->sf, &(SDL_Rect){wX, wY, wWidth, wHeight}, sf, NULL);
|
||||
|
||||
scg_new(CG_SET, wNumDstCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 元のCGの一部を切りぬいたCGを作成
|
||||
int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
spcg_assert_no(wNumDstCG);
|
||||
spcg_assert_no(wNumSrcCG);
|
||||
void scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight) {
|
||||
SPCG_ASSERT_NO(wNumDstCG);
|
||||
SPCG_ASSERT_NO(wNumSrcCG);
|
||||
|
||||
cginfo_t *src = scg_get(wNumSrcCG);
|
||||
if (!src)
|
||||
return NG;
|
||||
return;
|
||||
|
||||
surface_t *sf;
|
||||
if (src->sf->alpha) {
|
||||
sf = sf_create_surface(src->sf->width, src->sf->height, src->sf->depth);
|
||||
gr_fill_alpha_map(sf, 0, 0, src->sf->width, src->sf->height, 255);
|
||||
} else {
|
||||
sf = sf_create_pixel(src->sf->width, src->sf->height, src->sf->depth);
|
||||
}
|
||||
|
||||
if (src->sf->pixel)
|
||||
gr_copy(sf, wX, wY, src->sf, wX, wY, wWidth, wHeight);
|
||||
if (src->sf->alpha)
|
||||
gr_copy_alpha_map(sf, wX, wY, src->sf, wX, wY, wWidth, wHeight);
|
||||
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormat(0, src->sf->w, src->sf->h, src->sf->format->BitsPerPixel, src->sf->format->format);
|
||||
SDL_FillRect(sf, NULL, SDL_MapRGBA(sf->format, 0, 0, 0, 255));
|
||||
SDL_BlitSurface(src->sf, &(SDL_Rect){wX, wY, wWidth, wHeight}, sf, &(SDL_Rect){wX, wY, wWidth, wHeight});
|
||||
|
||||
scg_new(CG_SET, wNumDstCG, sf);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 全てのCGの開放
|
||||
int scg_freeall() {
|
||||
void scg_freeall(void) {
|
||||
int i;
|
||||
|
||||
for (i = 1; i < CGMAX; i++) {
|
||||
scg_free(i);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定の番号の CG をオブジェクトリストから消し、オブジェクトがどこからも参照
|
||||
* されていない(参照数が0の)場合のみ、オブジェクトを削除
|
||||
*/
|
||||
int scg_free(int no) {
|
||||
spcg_assert_no(no);
|
||||
void scg_free(int no) {
|
||||
SPCG_ASSERT_NO(no);
|
||||
|
||||
cginfo_t *cg = sact.cg[no];
|
||||
if (!cg) return NG;
|
||||
if (!cg) return;
|
||||
|
||||
scg_deref(cg);
|
||||
sact.cg[no] = NULL;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// CGの種類を取得
|
||||
int scg_querytype(int wNumCG, int *ret) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (sact.cg[wNumCG] == NULL) goto errexit;
|
||||
|
||||
*ret = sact.cg[wNumCG]->type;
|
||||
|
||||
return OK;
|
||||
|
||||
errexit:
|
||||
*ret = CG_NOTUSED;
|
||||
return NG;
|
||||
int scg_querytype(int wNumCG) {
|
||||
if (wNumCG >= (CGMAX -1)) return CG_NOTUSED;
|
||||
if (sact.cg[wNumCG] == NULL) return CG_NOTUSED;
|
||||
return sact.cg[wNumCG]->type;
|
||||
}
|
||||
|
||||
// CGの大きさを取得
|
||||
int scg_querysize(int wNumCG, int *w, int *h) {
|
||||
bool scg_querysize(int wNumCG, int *w, int *h) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (sact.cg[wNumCG] == NULL) goto errexit;
|
||||
if (sact.cg[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*w = sact.cg[wNumCG]->sf->width;
|
||||
*h = sact.cg[wNumCG]->sf->height;
|
||||
*w = sact.cg[wNumCG]->sf->w;
|
||||
*h = sact.cg[wNumCG]->sf->h;
|
||||
|
||||
return OK;
|
||||
return true;
|
||||
|
||||
errexit:
|
||||
*w = *h = 0;
|
||||
return NG;
|
||||
return false;
|
||||
}
|
||||
|
||||
// CGのBPPを取得
|
||||
int scg_querybpp(int wNumCG, int *ret) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (sact.cg[wNumCG] == NULL) goto errexit;
|
||||
if (sact.cg[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*ret = sact.cg[wNumCG]->sf->depth;
|
||||
|
||||
return OK;
|
||||
|
||||
errexit:
|
||||
*ret = 0;
|
||||
return NG;
|
||||
int scg_querybpp(int wNumCG) {
|
||||
if (wNumCG >= (CGMAX -1)) return 0;
|
||||
if (sact.cg[wNumCG] == NULL) return 0;
|
||||
if (sact.cg[wNumCG]->sf == NULL) return 0;
|
||||
return sact.cg[wNumCG]->sf->format->BitsPerPixel;
|
||||
}
|
||||
|
||||
// CGの alphamap が存在するかを取得
|
||||
int scg_existalphamap(int wNumCG, int *ret) {
|
||||
if (wNumCG >= (CGMAX -1)) goto errexit;
|
||||
if (sact.cg[wNumCG] == NULL) goto errexit;
|
||||
if (sact.cg[wNumCG]->sf == NULL) goto errexit;
|
||||
|
||||
*ret = sact.cg[wNumCG]->sf->alpha ? 1 : 0;
|
||||
|
||||
errexit:
|
||||
*ret = 0;
|
||||
return NG;
|
||||
bool scg_existalphamap(int wNumCG) {
|
||||
if (wNumCG >= (CGMAX -1)) return false;
|
||||
if (sact.cg[wNumCG] == NULL) return false;
|
||||
if (sact.cg[wNumCG]->sf == NULL) return false;
|
||||
return SDL_ISPIXELFORMAT_ALPHA(sact.cg[wNumCG]->sf->format->format);
|
||||
}
|
||||
|
||||
+17
-18
@@ -27,23 +27,22 @@
|
||||
#include "portab.h"
|
||||
#include "sact.h"
|
||||
|
||||
extern cginfo_t *scg_addref(int no);
|
||||
extern void scg_deref(cginfo_t *cg);
|
||||
extern int scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate);
|
||||
extern int scg_create_reverse(int NumCG, int wNumSrcCG, int wReverseX, int wReverseY);
|
||||
extern int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG);
|
||||
extern int scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode);
|
||||
extern int scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText);
|
||||
extern int scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue);
|
||||
extern int scg_copy(int wNumDstCG, int wNumSrcCG);
|
||||
extern int scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
extern int scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
extern int scg_freeall();
|
||||
extern int scg_free(int cg);
|
||||
extern int scg_querytype(int wNumCG, int *ret);
|
||||
extern int scg_querysize(int wNumCG, int *w, int *h);
|
||||
extern int scg_querybpp(int wNumCG, int *ret);
|
||||
extern int scg_existalphamap(int wNumCG, int *ret);
|
||||
extern int scg_linkcgfree(int no);
|
||||
cginfo_t *scg_addref(int no);
|
||||
void scg_deref(cginfo_t *cg);
|
||||
void scg_create(int wNumCG, int wWidth, int wHeight, int wR, int wG, int wB, int wBlendRate);
|
||||
void scg_create_reverse(int NumCG, int wNumSrcCG, int wReverseX, int wReverseY);
|
||||
void scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG);
|
||||
void scg_create_blend(int wNumDstCG, int wNumBaseCG, int wX, int wY, int wNumBlendCG, int wAlphaMapMode);
|
||||
void scg_create_text(int wNumCG, int wSize, int wR, int wG, int wB, int wText);
|
||||
void scg_create_textnum(int wNumCG, int wSize, int wR, int wG, int wB, int wFigs, int wZeroPadding, int wValue);
|
||||
void scg_copy(int wNumDstCG, int wNumSrcCG);
|
||||
void scg_cut(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
void scg_partcopy(int wNumDstCG, int wNumSrcCG, int wX, int wY, int wWidth, int wHeight);
|
||||
void scg_freeall(void);
|
||||
void scg_free(int cg);
|
||||
int scg_querytype(int wNumCG);
|
||||
bool scg_querysize(int wNumCG, int *w, int *h);
|
||||
int scg_querybpp(int wNumCG);
|
||||
bool scg_existalphamap(int wNumCG);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
//
|
||||
static surface_t *blend(surface_t *base, int x, int y, surface_t *blend, int mode) {
|
||||
surface_t *dst = sf_create_surface(base->width, base->height, base->depth);
|
||||
|
||||
gr_copy(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
|
||||
if (base->alpha) {
|
||||
// ベースに alpha map がある場合はそれをコピー
|
||||
gr_copy_alpha_map(dst, 0, 0, base, 0, 0, base->width, base->height);
|
||||
} else {
|
||||
// 無い場合は全て 255 の map を作成
|
||||
gr_fill_alpha_map(dst, 0, 0, base->width, base->height, 255);
|
||||
}
|
||||
|
||||
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 {
|
||||
// 無いときは dst の alpha map を使う
|
||||
gre_BlendUseAMap(dst, x, y, base, x, y, blend, 0, 0, blend->width, blend->height, dst, x, y, 255);
|
||||
}
|
||||
|
||||
// alpha 作成モードが dst + blend の時は飽和加算
|
||||
if (mode == 1) {
|
||||
gr_saturadd_alpha_map(dst, x, y, blend, 0, 0, blend->width, blend->height);
|
||||
}
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
// 拡大縮小
|
||||
static surface_t *stretch(surface_t *src, int dw, int dh, int mirror) {
|
||||
surface_t *dst = calloc(1, sizeof(surface_t));
|
||||
float a1, a2, xd, yd;
|
||||
int sw, sh;
|
||||
int *row, *col;
|
||||
int x, y;
|
||||
uint8_t *sdata, *ddata;
|
||||
|
||||
dst->width = dw;
|
||||
dst->height = dh;
|
||||
dst->depth = src->depth;
|
||||
dst->bytes_per_line = dw * src->bytes_per_pixel;
|
||||
dst->bytes_per_pixel = src->bytes_per_pixel;
|
||||
|
||||
if (src->pixel) {
|
||||
dst->pixel = malloc(dh * dst->bytes_per_line);
|
||||
}
|
||||
if (src->alpha) {
|
||||
dst->alpha = malloc(dw * dh);
|
||||
}
|
||||
|
||||
|
||||
sdata = GETOFFSET_PIXEL(src, 0, 0);
|
||||
ddata = GETOFFSET_PIXEL(dst, 0, 0);
|
||||
sw = src->width;
|
||||
sh = src->height;
|
||||
|
||||
a1 = (float)sw / (float)dw;
|
||||
a2 = (float)sh / (float)dh;
|
||||
row = malloc(sizeof(int) * dw);
|
||||
// 1おおきくして初期化しないと col[dw-1]とcol[dw]が同じになる
|
||||
// 可能性がある。
|
||||
col = calloc(dh +1, sizeof(int));
|
||||
|
||||
if (mirror & 1) {
|
||||
/* 上下反転 added by tajiri@wizard */
|
||||
for (yd = sh - a2, y = 0; y < dh; y++) {
|
||||
col[y] = yd; yd -= a2;
|
||||
}
|
||||
} else {
|
||||
for (yd = 0.0, y = 0; y < dh; y++) {
|
||||
col[y] = yd; yd += a2;
|
||||
}
|
||||
}
|
||||
if (mirror & 2) {
|
||||
/* 左右反転 added by tajiri@wizard */
|
||||
for (xd = sw - a1, x = 0; x < dw; x++) {
|
||||
row[x] = xd; xd -= a1;
|
||||
}
|
||||
} else {
|
||||
for (xd = 0.0, x = 0; x < dw; x++) {
|
||||
row[x] = xd; xd += a1;
|
||||
}
|
||||
}
|
||||
|
||||
#define SCALEDCOPYAREA(type) { \
|
||||
int x, y; \
|
||||
type *sl, *dl; \
|
||||
uint8_t *_sl, *_dl; \
|
||||
for (y = 0; y < dh; y++) { \
|
||||
sl = (type *)(sdata + *(y + col) * src->bytes_per_line);\
|
||||
dl = (type *)(ddata + y * dst->bytes_per_line);\
|
||||
for (x = 0; x < dw; x++) { \
|
||||
*(dl + x) = *(sl + *(row + x)); \
|
||||
} \
|
||||
_dl = (uint8_t *)dl; \
|
||||
while(*(col + y) == *(col + y + 1)) { \
|
||||
_sl = _dl; \
|
||||
_dl += dst->bytes_per_line; \
|
||||
memcpy(_dl, _sl, dw * sizeof(type)); \
|
||||
y++; \
|
||||
} \
|
||||
}}
|
||||
|
||||
switch(dst->depth) {
|
||||
case 8:
|
||||
SCALEDCOPYAREA(uint8_t); break;
|
||||
case 16:
|
||||
SCALEDCOPYAREA(uint16_t); break;
|
||||
case 24:
|
||||
case 32:
|
||||
SCALEDCOPYAREA(uint32_t); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (src->alpha) {
|
||||
int x, y;
|
||||
uint8_t *sl, *dl;
|
||||
uint8_t *_sl, *_dl;
|
||||
sdata = GETOFFSET_ALPHA(src, 0, 0);
|
||||
ddata = GETOFFSET_ALPHA(dst, 0, 0);
|
||||
for (y = 0; y < dh; y++) {
|
||||
sl = (uint8_t *)(sdata + *(y + col) * src->width);
|
||||
dl = (uint8_t *)(ddata + y * dst->width);
|
||||
for (x = 0; x < dw; x++) {
|
||||
*(dl + x) = *(sl + *(row + x));
|
||||
}
|
||||
_dl = (uint8_t *)dl;
|
||||
while(*(col + y) == *(col + y + 1)) {
|
||||
_sl = _dl;
|
||||
_dl += dst->width;
|
||||
memcpy(_dl, _sl, dw);
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(row);
|
||||
free(col);
|
||||
|
||||
return dst;
|
||||
}
|
||||
@@ -25,13 +25,12 @@
|
||||
#include "portab.h"
|
||||
|
||||
// グラフ用チャート作成
|
||||
int schart_pos(int *pos, int pos1, int pos2, int val1, int val2, int val) {
|
||||
void schart_pos(int *pos, int pos1, int pos2, int val1, int val2, int val) {
|
||||
if (val1 == val2) {
|
||||
*pos = 0;
|
||||
} else {
|
||||
*pos = (((pos2 - pos1) * (val - val1)) / (val2 - val1)) + pos1;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
#ifndef __SACTCHART_H__
|
||||
#define __SACTCHART_H__
|
||||
|
||||
extern int schart_pos(int *pos, int pos1, int pos2, int val1, int val2, int val);
|
||||
void schart_pos(int *pos, int pos1, int pos2, int val1, int val2, int val);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,23 +31,19 @@
|
||||
適当でいいとおもう
|
||||
*/
|
||||
|
||||
int scryp_encrypt_word(int *array, int num, int key) {
|
||||
void scryp_encrypt_word(int *array, int num, int key) {
|
||||
WARNING("NOT IMPLEMENTED");
|
||||
return OK;
|
||||
}
|
||||
|
||||
int scryp_decrypt_word(int *array, int num, int key) {
|
||||
void scryp_decrypt_word(int *array, int num, int key) {
|
||||
WARNING("NOT IMPLEMENTED");
|
||||
return OK;
|
||||
}
|
||||
|
||||
int scryp_encrypt_str(int strno, int key) {
|
||||
void scryp_encrypt_str(int strno, int key) {
|
||||
WARNING("NOT IMPLEMENTED");
|
||||
return OK;
|
||||
}
|
||||
|
||||
int scryp_decrypt_str(int strno, int key) {
|
||||
void scryp_decrypt_str(int strno, int key) {
|
||||
WARNING("str = '%s'", svar_get(strno));
|
||||
WARNING("NOT IMPLEMENTED");
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
#ifndef __SACTCRYPT_H__
|
||||
#define __SACTCRYPT_H__
|
||||
|
||||
extern int scryp_encrypt_word(int *array, int num, int key);
|
||||
extern int scryp_decrypt_word(int *array, int num, int key);
|
||||
extern int scryp_encrypt_str(int strno, int key);
|
||||
extern int scryp_decrypt_str(int strno, int key);
|
||||
void scryp_encrypt_word(int *array, int num, int key);
|
||||
void scryp_decrypt_word(int *array, int num, int key);
|
||||
void scryp_encrypt_str(int strno, int key);
|
||||
void scryp_decrypt_str(int strno, int key);
|
||||
|
||||
#endif
|
||||
|
||||
+28
-34
@@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
@@ -35,7 +36,6 @@
|
||||
#include "nact.h"
|
||||
#include "sact.h"
|
||||
#include "sprite.h"
|
||||
#include "ngraph.h"
|
||||
#include "drawtext.h"
|
||||
#include "utfsjis.h"
|
||||
|
||||
@@ -58,10 +58,9 @@ static const char *logmsg_utf8[LOGMSG_LINES] = {
|
||||
|
||||
#define FONTSIZEINDEX 10
|
||||
#define FONTSIZE 20
|
||||
#define LOGLINENUM (sf0->height / FONTSIZE)
|
||||
#define LOGLINENUM (main_surface->h / FONTSIZE)
|
||||
static int curline;
|
||||
static surface_t *back;
|
||||
static surface_t *chr;
|
||||
static SDL_Surface *back;
|
||||
|
||||
static void draw_log() {
|
||||
int i, y = 0, len;
|
||||
@@ -69,14 +68,20 @@ static void draw_log() {
|
||||
char pinfo[256];
|
||||
List *node;
|
||||
|
||||
// canvas clear
|
||||
memset(chr->pixel, 0, chr->bytes_per_line * chr->height);
|
||||
|
||||
SDL_Surface *hline = SDL_CreateRGBSurfaceWithFormat(0, main_surface->w, 3, 32, SDL_PIXELFORMAT_RGB888);
|
||||
SDL_FillRect(hline, NULL, SDL_MapRGB(hline->format, 255, 255, 255));
|
||||
SDL_SetSurfaceBlendMode(hline, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetSurfaceAlphaMod(hline, 128);
|
||||
|
||||
SDL_SetSurfaceColorMod(back, 128, 128, 128);
|
||||
SDL_BlitSurface(back, NULL, main_surface, NULL);
|
||||
SDL_SetSurfaceColorMod(back, 255, 255, 255);
|
||||
|
||||
// ページ位置情報
|
||||
len = snprintf(pinfo, sizeof(pinfo) -1, "%d/%d", curline, list_length(sact.log));
|
||||
|
||||
dt_setfont(FONT_GOTHIC, FONTSIZEINDEX);
|
||||
dt_drawtext(chr, sf0->width - FONTSIZEINDEX *len /2, 0, pinfo);
|
||||
dt_drawtext_col(main_surface, main_surface->w - FONTSIZEINDEX *len /2, 0, pinfo, 255, 255, 255);
|
||||
|
||||
// 表示始め位置
|
||||
node = list_nth(sact.log, list_length(sact.log) - curline);
|
||||
@@ -85,31 +90,28 @@ static void draw_log() {
|
||||
|
||||
char *str = (char *)(node->data);
|
||||
if (0 == strcmp(str, "\n")) {
|
||||
gr_fill(chr, 0, y + FONTSIZE/2, sf0->width, 3, 128, 0, 0);
|
||||
SDL_BlitSurface(hline, NULL, main_surface, &(SDL_Rect){0, y + FONTSIZE/2, main_surface->w, 3});
|
||||
} else {
|
||||
if (cur < 6) {
|
||||
dt_setfont(FONT_MINCHO, FONTSIZE);
|
||||
} else {
|
||||
dt_setfont(FONT_GOTHIC, FONTSIZE);
|
||||
}
|
||||
dt_drawtext(chr, 0, y, str);
|
||||
dt_drawtext_col(main_surface, 0, y, str, 255, 255, 255);
|
||||
}
|
||||
y += FONTSIZE;
|
||||
cur--;
|
||||
node = list_next(node);
|
||||
}
|
||||
|
||||
gr_copy_bright(sf0, 0, 0, back, 0, 0, sf0->width, sf0->height, 128);
|
||||
gr_expandcolor_blend(sf0, 0, 0, chr, 0, 0, sf0->width, sf0->height,
|
||||
255, 255, 255);
|
||||
|
||||
ags_updateFull();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int sblog_start(void) {
|
||||
bool sblog_start(void) {
|
||||
if (sact.version < 120)
|
||||
return NG;
|
||||
return false;
|
||||
|
||||
static char *logmsg[LOGMSG_LINES];
|
||||
if (!logmsg[0]) {
|
||||
@@ -121,52 +123,44 @@ int sblog_start(void) {
|
||||
for (int i = 0; i < LOGMSG_LINES; i++)
|
||||
sact.log = list_append(sact.log, logmsg[i]);
|
||||
|
||||
back = sf_dup(sf0);
|
||||
chr = sf_create_surface(sf0->width, sf0->height, 8);
|
||||
back = SDL_ConvertSurface(main_surface, main_surface->format, 0);
|
||||
curline = 6;
|
||||
draw_log();
|
||||
return OK;
|
||||
return true;
|
||||
}
|
||||
|
||||
int sblog_end(void) {
|
||||
void sblog_end(void) {
|
||||
List *node;
|
||||
int i;
|
||||
|
||||
sf_copyall(sf0, back);
|
||||
SDL_BlitSurface(back, NULL, main_surface, NULL);
|
||||
ags_updateFull();
|
||||
|
||||
sf_free(back);
|
||||
sf_free(chr);
|
||||
|
||||
SDL_FreeSurface(back);
|
||||
|
||||
// 説明文章を削除
|
||||
for (i = 0; i < LOGMSG_LINES; i++) {
|
||||
node = list_last(sact.log);
|
||||
sact.log = list_remove(sact.log, node->data);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int sblog_pageup(void) {
|
||||
void sblog_pageup(void) {
|
||||
curline = min(list_length(sact.log), curline + (LOGLINENUM -1));
|
||||
draw_log();
|
||||
return OK;
|
||||
}
|
||||
|
||||
int sblog_pagedown(void) {
|
||||
void sblog_pagedown(void) {
|
||||
curline = max(1, curline - (LOGLINENUM -1));
|
||||
draw_log();
|
||||
return OK;
|
||||
}
|
||||
|
||||
int sblog_pagepre(void) {
|
||||
void sblog_pagepre(void) {
|
||||
curline = max(1, curline - 1);
|
||||
draw_log();
|
||||
return OK;
|
||||
}
|
||||
|
||||
int sblog_pagenext(void) {
|
||||
void sblog_pagenext(void) {
|
||||
curline = min(list_length(sact.log), curline + 1);
|
||||
draw_log();
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
#ifndef __SACTLOG_H__
|
||||
#define __SACTLOG_H__
|
||||
|
||||
extern int sblog_start(void);
|
||||
extern int sblog_end(void);
|
||||
extern int sblog_pageup(void);
|
||||
extern int sblog_pagedown(void);
|
||||
extern int sblog_pagepre(void);
|
||||
extern int sblog_pagenext(void);
|
||||
bool sblog_start(void);
|
||||
void sblog_end(void);
|
||||
void sblog_pageup(void);
|
||||
void sblog_pagedown(void);
|
||||
void sblog_pagepre(void);
|
||||
void sblog_pagenext(void);
|
||||
|
||||
#endif
|
||||
|
||||
+14
-28
@@ -64,27 +64,24 @@ static int slt_find(int no) {
|
||||
/*
|
||||
SACT 効果音 subsystem 初期化
|
||||
*/
|
||||
int ssnd_init() {
|
||||
void ssnd_init(void) {
|
||||
// ch 1-8 をキャッシュとして使おう
|
||||
cachei = 0;
|
||||
memset(cache, 0, sizeof(cache));
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定の番号の効果音をメモリに読み込み
|
||||
int ssnd_prepare(int no) {
|
||||
void ssnd_prepare(int no) {
|
||||
int slot = slt_find(no);
|
||||
|
||||
if (slot == -1) {
|
||||
slot = slt_getnext(no);
|
||||
mus_wav_load(slot, no);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定の番号の効果音を再生
|
||||
int ssnd_play(int no) {
|
||||
void ssnd_play(int no) {
|
||||
int slot = slt_find(no);
|
||||
|
||||
if (slot == -1) {
|
||||
@@ -92,45 +89,40 @@ int ssnd_play(int no) {
|
||||
mus_wav_load(slot, no);
|
||||
}
|
||||
mus_wav_play(slot, 1);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定の番号の効果音を再生停止
|
||||
int ssnd_stop(int no, int fadetime) {
|
||||
void ssnd_stop(int no, int fadetime) {
|
||||
int slot = slt_find(no);
|
||||
|
||||
if (slot != -1) {
|
||||
mus_wav_fadeout_start(slot, fadetime, 0, TRUE);
|
||||
mus_wav_fadeout_start(slot, fadetime, 0, true);
|
||||
cache[slot - SLOTOFFSET] = 0;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定の番号の効果音が再生終了するのを待つ
|
||||
int ssnd_wait(int no) {
|
||||
void ssnd_wait(int no) {
|
||||
int slot = slt_find(no);
|
||||
|
||||
if (slot != -1) {
|
||||
mus_wav_waitend(slot);
|
||||
cache[slot - SLOTOFFSET] = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定の効果音が終了するか、キーが押されるまで待つ
|
||||
int ssnd_waitkey(int no, int *res) {
|
||||
void ssnd_waitkey(int no, int *res) {
|
||||
int slot = slt_find(no);
|
||||
|
||||
if (slot == -1) {
|
||||
*res = 0;
|
||||
return OK;
|
||||
return;
|
||||
}
|
||||
|
||||
if (sact.waitskiplv > 1) {
|
||||
*res = SYS35KEY_RET;
|
||||
return OK;
|
||||
return;
|
||||
}
|
||||
|
||||
sact.waittype = KEYWAIT_SIMPLE;
|
||||
@@ -147,39 +139,33 @@ int ssnd_waitkey(int no, int *res) {
|
||||
*res = sact.waitkey;
|
||||
}
|
||||
sact.waittype = KEYWAIT_NONE;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 左右チャンネルの反転した効果音をメモリに読み込む
|
||||
int ssnd_prepareLRrev(int no) {
|
||||
void ssnd_prepareLRrev(int no) {
|
||||
mus_wav_load_lrsw(30, no); // slot は 30固定でいい?
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 左右チャンネルの反転した効果音を再生
|
||||
int ssnd_playLRrev(int no) {
|
||||
void ssnd_playLRrev(int no) {
|
||||
mus_wav_load_lrsw(30, no);
|
||||
mus_wav_play(30, 1);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定の番号の効果音が存在するかどうかをチェック
|
||||
int ssnd_getlinknum(int no) {
|
||||
WARNING("NOT IMPLEMENTED");
|
||||
return OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// すべての再生中の効果音が再生を終了するのを待つ
|
||||
int ssnd_stopall(int time) {
|
||||
void ssnd_stopall(int time) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < CACHEMAX; i++) {
|
||||
if (cache[i] > 0) {
|
||||
mus_wav_fadeout_start(i + SLOTOFFSET, time, 0, TRUE);
|
||||
mus_wav_fadeout_start(i + SLOTOFFSET, time, 0, true);
|
||||
cache[i] = 0;
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
+10
-10
@@ -24,15 +24,15 @@
|
||||
#ifndef __SACTSOUND_H__
|
||||
#define __SACTSOUND_H__
|
||||
|
||||
extern int ssnd_init();
|
||||
extern int ssnd_play(int no);
|
||||
extern int ssnd_stop(int no, int fadetime);
|
||||
extern int ssnd_wait(int no);
|
||||
extern int ssnd_waitkey(int no, int *res);
|
||||
extern int ssnd_prepare(int no);
|
||||
extern int ssnd_prepareLRrev(int no);
|
||||
extern int ssnd_playLRrev(int no);
|
||||
extern int ssnd_getlinknum(int no);
|
||||
extern int ssnd_stopall(int time);
|
||||
void ssnd_init(void);
|
||||
void ssnd_play(int no);
|
||||
void ssnd_stop(int no, int fadetime);
|
||||
void ssnd_wait(int no);
|
||||
void ssnd_waitkey(int no, int *res);
|
||||
void ssnd_prepare(int no);
|
||||
void ssnd_prepareLRrev(int no);
|
||||
void ssnd_playLRrev(int no);
|
||||
int ssnd_getlinknum(int no);
|
||||
void ssnd_stopall(int time);
|
||||
|
||||
#endif /* __SACTSOUND_H__ */
|
||||
|
||||
@@ -39,14 +39,13 @@ static int idxmax; // stack pointerの最大
|
||||
/**
|
||||
* 文字列変数スタックの初期化
|
||||
*/
|
||||
int sstr_init() {
|
||||
void sstr_init(void) {
|
||||
stack = malloc(sizeof(char *) * DEFSTACKSIZE);
|
||||
idx = 0;
|
||||
idxmax = DEFSTACKSIZE;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int sstr_reset(void) {
|
||||
void sstr_reset(void) {
|
||||
for (int i = 0; i < idx; i++)
|
||||
free(stack[i]);
|
||||
idx = 0;
|
||||
@@ -61,35 +60,30 @@ int sstr_reset(void) {
|
||||
}
|
||||
slist_free(sact.strreplace);
|
||||
sact.strreplace = NULL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字列変数スタックに文字列を積む
|
||||
* @param strno: シナリオ上での文字列変数番号
|
||||
*/
|
||||
int sstr_push(int strno) {
|
||||
void sstr_push(int strno) {
|
||||
if (idx >= idxmax) {
|
||||
stack = realloc(stack, sizeof(char *) * idx*2);
|
||||
idxmax = idx*2;
|
||||
}
|
||||
|
||||
stack[idx++] = strdup(svar_get(strno));
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字列変数スタックから文字列を取り出す
|
||||
* @param strno: スタックから戻した文字列を格納する文字列変数番号
|
||||
*/
|
||||
int sstr_pop(int strno) {
|
||||
if (idx == 0) return NG;
|
||||
void sstr_pop(int strno) {
|
||||
if (idx == 0) return;
|
||||
|
||||
svar_set(strno, stack[--idx]);
|
||||
free(stack[idx]);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,22 +91,21 @@ int sstr_pop(int strno) {
|
||||
* @param sstrno: 変換元文字列変数番号
|
||||
* @param dstrno: 変換先文字列変数番号
|
||||
*/
|
||||
int sstr_regist_replace(int sstrno, int dstrno) {
|
||||
void sstr_regist_replace(int sstrno, int dstrno) {
|
||||
strexchange_t *ex;
|
||||
|
||||
if (sstrno == dstrno) return NG;
|
||||
if (sstrno == dstrno) return;
|
||||
|
||||
ex = malloc(sizeof(strexchange_t));
|
||||
ex->src = strdup(svar_get(sstrno));
|
||||
ex->dst = strdup(svar_get(dstrno));
|
||||
sact.strreplace = slist_append(sact.strreplace, ex);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数値 -> 文字列化
|
||||
*/
|
||||
int sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
void sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
char s[256], ss[256];
|
||||
|
||||
if (nzeropad) {
|
||||
@@ -125,6 +118,4 @@ int sstr_num2str(int strno, int fig, int nzeropad, int num) {
|
||||
|
||||
sprintf(s, ss, num);
|
||||
svar_set(strno, s);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
#ifndef __SACTSTRING_H__
|
||||
#define __SACTSTRING_H__
|
||||
|
||||
extern int sstr_init();
|
||||
extern int sstr_reset(void);
|
||||
extern int sstr_push(int strno);
|
||||
extern int sstr_pop(int strno);
|
||||
extern int sstr_regist_replace(int sstrtno, int dstrno);
|
||||
extern int sstr_num2str(int strno, int fig, int nzeropad, int num);
|
||||
void sstr_init(void);
|
||||
void sstr_reset(void);
|
||||
void sstr_push(int strno);
|
||||
void sstr_pop(int strno);
|
||||
void sstr_regist_replace(int sstrtno, int dstrno);
|
||||
void sstr_num2str(int strno, int fig, int nzeropad, int num);
|
||||
|
||||
|
||||
#endif /* __SACTSTRING_H__ */
|
||||
|
||||
@@ -32,16 +32,14 @@
|
||||
/*
|
||||
sact timer subsystem 初期化
|
||||
*/
|
||||
int stimer_init() {
|
||||
void stimer_init(void) {
|
||||
stimer_reset(0, 0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定IDのタイマーのリセット
|
||||
int stimer_reset(int id, int val) {
|
||||
void stimer_reset(int id, int val) {
|
||||
gettimeofday(&(sact.timer[id].tv_base), NULL);
|
||||
sact.timer[id].val = val;
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定IDのタイマーの取得
|
||||
|
||||
@@ -34,8 +34,8 @@ struct _stimer {
|
||||
typedef struct _stimer stimer_t;
|
||||
|
||||
|
||||
extern int stimer_init();
|
||||
extern int stimer_reset(int id, int val);
|
||||
extern int stimer_get(int id);
|
||||
void stimer_init(void);
|
||||
void stimer_reset(int id, int val);
|
||||
int stimer_get(int id);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
#include "ags.h"
|
||||
#include "input.h"
|
||||
#include "sact.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "sprite.h"
|
||||
#include "sdl_core.h"
|
||||
#include "randMT.h"
|
||||
@@ -73,12 +71,12 @@ static void quake1(float curstep, int diam, int round, int *adjx, int *adjy) {
|
||||
@param wCount: 時間(1/100秒)
|
||||
@param nfKeyEnable: キー抜け (1で有効)
|
||||
*/
|
||||
int sp_quake_screen(int type, int p1, int p2, int time, int cancel) {
|
||||
void sp_quake_screen(int type, int p1, int p2, int time, int cancel) {
|
||||
int sttime, edtime, curtime;
|
||||
int key;
|
||||
entrypoint *cb[2] = {quake0, quake1};
|
||||
|
||||
if (type > 1) return OK;
|
||||
if (type > 1) return;
|
||||
|
||||
sttime = sdl_getTicks();
|
||||
edtime = time * 10 + sttime;
|
||||
@@ -86,16 +84,14 @@ int sp_quake_screen(int type, int p1, int p2, int time, int cancel) {
|
||||
int adjx, adjy;
|
||||
|
||||
cb[type]((float)(curtime - sttime)/(edtime - sttime), p1, p2, &adjx, &adjy);
|
||||
ags_setViewArea(adjx, adjy, sf0->width, sf0->height);
|
||||
ags_setViewArea(adjx, adjy, main_surface->w, main_surface->h);
|
||||
ags_updateFull();
|
||||
|
||||
key = sys_keywait(10, cancel ? KEYWAIT_CANCELABLE : KEYWAIT_NONCANCELABLE);
|
||||
if (cancel && key) break;
|
||||
}
|
||||
|
||||
ags_setViewArea(0, 0, sf0->width, sf0->height);
|
||||
ags_setViewArea(0, 0, main_surface->w, main_surface->h);
|
||||
ags_updateFull();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
+108
-185
@@ -26,33 +26,25 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "list.h"
|
||||
#include "ngraph.h"
|
||||
#include "ags.h"
|
||||
#include "nact.h"
|
||||
#include "sact.h"
|
||||
#include "sprite.h"
|
||||
#include "surface.h"
|
||||
#include "sactcg.h"
|
||||
#include "sactsound.h"
|
||||
|
||||
static int compare_spriteno_smallfirst(const void *a, const void *b);
|
||||
|
||||
|
||||
#define sp_assert_no(no) do { \
|
||||
#define SP_ASSERT_NO(no) do { \
|
||||
if ((no) >= SPRITEMAX) { \
|
||||
WARNING("no is too large (should be %d < %d)", no, SPRITEMAX); \
|
||||
return NG; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define sp_assert_null(no) do { \
|
||||
if (sact.sp[no] == NULL) { \
|
||||
WARNING("sprite %d is NULL", no); \
|
||||
return NG; \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -72,27 +64,14 @@ static int compare_spriteno_smallfirst(const void *a, const void *b) {
|
||||
}
|
||||
|
||||
// デフォルトの壁紙update
|
||||
static int sp_draw_wall(sprite_t *sp) {
|
||||
int sx, sy, w, h;
|
||||
|
||||
sx = sact.updaterect.x;
|
||||
sy = sact.updaterect.y;
|
||||
w = sact.updaterect.w;
|
||||
h = sact.updaterect.h;
|
||||
gr_fill(sf0, sx, sy, w, h, 0, 0, 0);
|
||||
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d",
|
||||
sp->no, sx, sy, w, h);
|
||||
|
||||
return OK;
|
||||
static void sp_draw_wall(sprite_t *sp) {
|
||||
SDL_FillRect(main_surface, &sact.updaterect, SDL_MapRGB(main_surface->format, 0, 0, 0));
|
||||
}
|
||||
|
||||
/**
|
||||
* sprite 関連の初期化
|
||||
* @param none
|
||||
* @return OK:成功, NG:失敗
|
||||
*/
|
||||
int sp_init() {
|
||||
void sp_init(void) {
|
||||
int i;
|
||||
|
||||
// DLL用メッセージ表示
|
||||
@@ -109,7 +88,7 @@ int sp_init() {
|
||||
sact.sp[i] = calloc(1, sizeof(sprite_t));
|
||||
sact.sp[i]->no = i;
|
||||
sact.sp[i]->type = SPRITE_NONE;
|
||||
sact.sp[i]->show = FALSE;
|
||||
sact.sp[i]->show = false;
|
||||
}
|
||||
|
||||
// 壁紙(スプライト番号0)はデフォルトへ
|
||||
@@ -117,15 +96,12 @@ int sp_init() {
|
||||
|
||||
// 壁紙を updateリストに追加
|
||||
sact.updatelist = slist_append(sact.updatelist, sact.sp[0]);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int sp_reset(void) {
|
||||
void sp_reset(void) {
|
||||
sp_clear_zkey_hidesprite_all();
|
||||
sp_clear_quakesprite_all();
|
||||
sp_free_all();
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,10 +112,10 @@ int sp_reset(void) {
|
||||
* @param cg3: 3枚目のCG (ない場合は0)
|
||||
* @param type: スプライトの種類
|
||||
*/
|
||||
int sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
void sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(no);
|
||||
SP_ASSERT_NO(no);
|
||||
|
||||
sp = sact.sp[no];
|
||||
|
||||
@@ -161,7 +137,7 @@ int sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
//初期のcurcgはcg1
|
||||
sp->curcg = sp->cg1;
|
||||
|
||||
sp->show = TRUE; // 初期状態は表示
|
||||
sp->show = true; // 初期状態は表示
|
||||
sp->blendrate = 255; // ブレンド無し
|
||||
sp->loc.x = 0; // 初期表示位置は(0,0)
|
||||
sp->loc.y = 0;
|
||||
@@ -172,8 +148,8 @@ int sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
sp->cursize.width = 0;
|
||||
sp->cursize.height = 0;
|
||||
} else {
|
||||
sp->cursize.width = sp->curcg->sf->width;
|
||||
sp->cursize.height = sp->curcg->sf->height;
|
||||
sp->cursize.width = sp->curcg->sf->w;
|
||||
sp->cursize.height = sp->curcg->sf->h;
|
||||
}
|
||||
|
||||
sp->freezed_state = 0; // 状態固定は無し
|
||||
@@ -199,15 +175,13 @@ int sp_new(int no, int cg1, int cg2, int cg3, int type) {
|
||||
sp_anime_setup(sp);
|
||||
break;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// メッセージスプライトの作成
|
||||
int sp_new_msg(int no, int x, int y, int width, int height) {
|
||||
void sp_new_msg(int no, int x, int y, int width, int height) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(no);
|
||||
SP_ASSERT_NO(no);
|
||||
|
||||
sp = sact.sp[no];
|
||||
|
||||
@@ -220,7 +194,7 @@ int sp_new_msg(int no, int x, int y, int width, int height) {
|
||||
|
||||
sp->type = SPRITE_MSG;
|
||||
sp->no = no;
|
||||
sp->show = TRUE; // 初期状態は表示
|
||||
sp->show = true; // 初期状態は表示
|
||||
sp->blendrate = 255; // ブレンド無し
|
||||
sp->freezed_state = 0; // 状態固定無し
|
||||
sp->loc.x = x - sact.origin.x; // 初期表示位置
|
||||
@@ -231,18 +205,16 @@ int sp_new_msg(int no, int x, int y, int width, int height) {
|
||||
sp->cursize.height = height;
|
||||
sp->cur = sp->loc;
|
||||
sp->u.msg.buf = NULL;
|
||||
|
||||
// 文字描画用キャンバス
|
||||
sp->u.msg.canvas = sf_create_surface(width, height, sf0->depth);
|
||||
|
||||
|
||||
// canvas for drawing text
|
||||
sp->u.msg.canvas = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_ARGB8888);
|
||||
|
||||
// スプライト再描画用コールバック
|
||||
sp->update = smsg_update;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 壁紙の設定
|
||||
int sp_set_wall_paper(int no) {
|
||||
void sp_set_wall_paper(int no) {
|
||||
sprite_t *sp = sact.sp[0];
|
||||
|
||||
if (sp->curcg)
|
||||
@@ -252,38 +224,35 @@ int sp_set_wall_paper(int no) {
|
||||
|
||||
if (sp->curcg) { // display specified CG
|
||||
sp->update = DEFAULT_UPDATE;
|
||||
sp->cursize.width = sp->curcg->sf->width;
|
||||
sp->cursize.height = sp->curcg->sf->height;
|
||||
sp->cursize.width = sp->curcg->sf->w;
|
||||
sp->cursize.height = sp->curcg->sf->h;
|
||||
} else { // Black
|
||||
sp->cursize.height = sf0->height;
|
||||
sp->cursize.height = main_surface->h;
|
||||
sp->curcg = NULL;
|
||||
sp->update = sp_draw_wall;
|
||||
}
|
||||
|
||||
sp->type = SPRITE_WP;
|
||||
sp->show = TRUE;
|
||||
sp->show = true;
|
||||
sp->blendrate = 255;
|
||||
sp->cur.x = 0;
|
||||
sp->cur.y = 0;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 全ての sprite を消去
|
||||
int sp_free_all() {
|
||||
void sp_free_all(void) {
|
||||
int i;
|
||||
|
||||
for (i = 1; i < SPRITEMAX; i++) {
|
||||
sp_free(i);
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 指定のsprite を消去
|
||||
int sp_free(int no) {
|
||||
void sp_free(int no) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(no);
|
||||
SP_ASSERT_NO(no);
|
||||
|
||||
sp = sact.sp[no];
|
||||
|
||||
@@ -310,7 +279,7 @@ int sp_free(int no) {
|
||||
|
||||
if (sp->type == SPRITE_MSG) {
|
||||
slist_free(sp->u.msg.buf);
|
||||
sf_free(sp->u.msg.canvas);
|
||||
SDL_FreeSurface(sp->u.msg.canvas);
|
||||
}
|
||||
sact.updatelist = slist_remove(sact.updatelist, sp);
|
||||
|
||||
@@ -321,50 +290,46 @@ int sp_free(int no) {
|
||||
memset(sp, 0, sizeof(sprite_t));
|
||||
sp->type = SPRITE_NONE;
|
||||
sp->no = no;
|
||||
sp->show = FALSE;
|
||||
sp->show = false;
|
||||
memcpy(&(sp->numeral), &(back.numeral), sizeof(sp->numeral));
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 表示状態の変更
|
||||
int sp_set_show(int wNum, int wCount, int sShow) {
|
||||
void sp_set_show(int wNum, int wCount, int sShow) {
|
||||
int i;
|
||||
boolean oldstate;
|
||||
bool oldstate;
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(wNum);
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
for (i = wNum; i < (wNum + wCount); i++) {
|
||||
if (i >= (SPRITEMAX -1)) break;
|
||||
sp = sact.sp[i];
|
||||
oldstate = sp->show;
|
||||
|
||||
sp->show = (sShow == 1 ? TRUE : FALSE);
|
||||
sp->show = sShow == 1;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 表示位置の設定
|
||||
int sp_set_pos(int wNum, int wX, int wY) {
|
||||
void sp_set_pos(int wNum, int wX, int wY) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(wNum);
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
sp = sact.sp[wNum];
|
||||
sp->loc.x = wX - sact.origin.x;
|
||||
sp->loc.y = wY - sact.origin.y;
|
||||
sp->cur.x = sp->loc.x;
|
||||
sp->cur.y = sp->loc.y;
|
||||
return OK;
|
||||
|
||||
}
|
||||
|
||||
// スプライトの移動
|
||||
int sp_set_move(int wNum, int wX, int wY) {
|
||||
void sp_set_move(int wNum, int wX, int wY) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(wNum);
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
sp = sact.sp[wNum];
|
||||
sp->move.to.x = wX - sact.origin.x;
|
||||
@@ -378,59 +343,52 @@ int sp_set_move(int wNum, int wX, int wY) {
|
||||
// moveするスプライトリストに登録
|
||||
// 実際に move を開始するのは ~SP_DRAW(sp_update_all)が呼ばれたとき
|
||||
sact.movelist = slist_append(sact.movelist, sp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// スプライト移動時間の設定
|
||||
int sp_set_movetime(int wNum, int wTime) {
|
||||
sp_assert_no(wNum);
|
||||
void sp_set_movetime(int wNum, int wTime) {
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
sact.sp[wNum]->move.time = wTime * 10;
|
||||
sact.sp[wNum]->move.speed = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
// スプライト移動速度の設定
|
||||
int sp_set_movespeed(int wNum, int wSpeed) {
|
||||
sp_assert_no(wNum);
|
||||
void sp_set_movespeed(int wNum, int wSpeed) {
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
if (wSpeed == 0) wSpeed = 1;
|
||||
|
||||
sact.sp[wNum]->move.speed = wSpeed;
|
||||
sact.sp[wNum]->move.time = 0;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// Zキーを押したときに隠すスプライトの登録
|
||||
int sp_add_zkey_hidesprite(int wNum) {
|
||||
void sp_add_zkey_hidesprite(int wNum) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(wNum);
|
||||
SP_ASSERT_NO(wNum);
|
||||
sp = sact.sp[wNum];
|
||||
|
||||
// 登録時点でまだ生成していないスプライトは隠さない
|
||||
// シェルクレイルでまずいのがあったので中止
|
||||
// if (sp->type == SPRITE_NONE) return NG;
|
||||
// if (sp->type == SPRITE_NONE) return;
|
||||
|
||||
sact.sp_zhide = slist_append(sact.sp_zhide, sp);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 上で登録したスプライトの削除
|
||||
int sp_clear_zkey_hidesprite_all() {
|
||||
void sp_clear_zkey_hidesprite_all(void) {
|
||||
slist_free(sact.sp_zhide);
|
||||
sact.sp_zhide = NULL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
// スプライト状態の固化
|
||||
int sp_freeze_sprite(int wNum, int wIndex) {
|
||||
void sp_freeze_sprite(int wNum, int wIndex) {
|
||||
sprite_t *sp;
|
||||
void *oldstate;
|
||||
|
||||
sp_assert_no(wNum);
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
sp = sact.sp[wNum];
|
||||
sp->freezed_state = wIndex;
|
||||
@@ -444,74 +402,60 @@ int sp_freeze_sprite(int wNum, int wIndex) {
|
||||
case 3:
|
||||
sp->curcg = sp->cg3; break;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 上で固化した状態の解除
|
||||
int sp_thaw_sprite(int wNum) {
|
||||
sp_assert_no(wNum);
|
||||
void sp_thaw_sprite(int wNum) {
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
sact.sp[wNum]->freezed_state = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
// SP_QUAKEで揺らすスプライトの登録
|
||||
int sp_add_quakesprite(int wNum) {
|
||||
sp_assert_no(wNum);
|
||||
void sp_add_quakesprite(int wNum) {
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
sact.sp_quake = slist_append(sact.sp_quake, sact.sp[wNum]);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 上で登録したスプライトの削除
|
||||
int sp_clear_quakesprite_all() {
|
||||
void sp_clear_quakesprite_all(void) {
|
||||
slist_free(sact.sp_quake);
|
||||
sact.sp_quake = NULL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
// アニメーションスプライトの間隔の設定
|
||||
int sp_set_animeinterval(int wNum, int wTime) {
|
||||
sp_assert_no(wNum);
|
||||
void sp_set_animeinterval(int wNum, int wTime) {
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
if (sact.sp[wNum]->type != SPRITE_ANIME) return NG;
|
||||
if (sact.sp[wNum]->type != SPRITE_ANIME) return;
|
||||
|
||||
sact.sp[wNum]->u.anime.interval = wTime * 10;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// スプライトのブレンド率の設定
|
||||
int sp_set_blendrate(int wNum, int wCount, int rate) {
|
||||
void sp_set_blendrate(int wNum, int wCount, int rate) {
|
||||
int i;
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(wNum);
|
||||
SP_ASSERT_NO(wNum);
|
||||
|
||||
for (i = wNum; i < (wNum + wCount); i++) {
|
||||
if (i >= (SPRITEMAX -1)) break;
|
||||
sp = sact.sp[i];
|
||||
sp->blendrate = rate;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// スプライトが create されているかどうかの取得
|
||||
int sp_query_isexist(int wNum, int *ret) {
|
||||
if (wNum >= SPRITEMAX) goto errexit;
|
||||
if (sact.sp[wNum]->type == SPRITE_NONE) goto errexit;
|
||||
|
||||
*ret = 1;
|
||||
return OK;
|
||||
|
||||
errexit:
|
||||
*ret = 0;
|
||||
return NG;
|
||||
bool sp_exists(int wNum) {
|
||||
if (wNum >= SPRITEMAX) return false;
|
||||
if (sact.sp[wNum]->type == SPRITE_NONE) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// スプライトのタイプと何番のCGがセットされているかの取得
|
||||
int sp_query_info(int wNum, int *vtype, int *vcg1, int *vcg2, int *vcg3) {
|
||||
bool sp_query_info(int wNum, int *vtype, int *vcg1, int *vcg2, int *vcg3) {
|
||||
sprite_t *sp;
|
||||
|
||||
if (wNum >= SPRITEMAX) goto errexit;
|
||||
@@ -524,46 +468,46 @@ int sp_query_info(int wNum, int *vtype, int *vcg1, int *vcg2, int *vcg3) {
|
||||
*vcg2 = sp->cg2 ? sp->cg2->no : 0;
|
||||
*vcg3 = sp->cg3 ? sp->cg3->no : 0;
|
||||
|
||||
return OK;
|
||||
return true;
|
||||
|
||||
errexit:
|
||||
*vtype = 0;
|
||||
*vcg1 = 0;
|
||||
*vcg2 = 0;
|
||||
*vcg3 = 0;
|
||||
return NG;
|
||||
return false;
|
||||
}
|
||||
|
||||
// スプライトの表示状態の取得
|
||||
int sp_query_show(int wNum, int *vShow) {
|
||||
bool sp_query_show(int wNum, int *vShow) {
|
||||
if (wNum >= SPRITEMAX) goto errexit;
|
||||
if (sact.sp[wNum]->type == SPRITE_NONE) goto errexit;
|
||||
|
||||
*vShow = sact.sp[wNum]->show ? 1: 0;
|
||||
return OK;
|
||||
return true;
|
||||
|
||||
errexit:
|
||||
*vShow = 0;
|
||||
return NG;
|
||||
return false;
|
||||
}
|
||||
|
||||
// スプライトの表示位置の取得
|
||||
int sp_query_pos(int wNum, int *vx, int *vy) {
|
||||
bool sp_query_pos(int wNum, int *vx, int *vy) {
|
||||
if (wNum >= SPRITEMAX) goto errexit;
|
||||
if (sact.sp[wNum]->type == SPRITE_NONE) goto errexit;
|
||||
|
||||
*vx = sact.sp[wNum]->loc.x;
|
||||
*vy = sact.sp[wNum]->loc.y;
|
||||
return OK;
|
||||
return true;
|
||||
|
||||
errexit:
|
||||
*vx = 0;
|
||||
*vy = 0;
|
||||
return NG;
|
||||
return false;
|
||||
}
|
||||
|
||||
// スプライトの大きさの取得
|
||||
int sp_query_size(int wNum, int *vw, int *vh) {
|
||||
bool sp_query_size(int wNum, int *vw, int *vh) {
|
||||
sprite_t *sp;
|
||||
|
||||
if (wNum >= SPRITEMAX) goto errexit;
|
||||
@@ -575,87 +519,76 @@ int sp_query_size(int wNum, int *vw, int *vh) {
|
||||
*vw = sp->cursize.width;
|
||||
*vh = sp->cursize.height;
|
||||
|
||||
return OK;
|
||||
return true;
|
||||
|
||||
errexit:
|
||||
*vw = 0;
|
||||
*vh = 0;
|
||||
return NG;
|
||||
return false;
|
||||
}
|
||||
|
||||
// テキストスプライトの現在の文字表示位置の取得
|
||||
int sp_query_textpos(int wNum, int *vx, int *vy) {
|
||||
bool sp_query_textpos(int wNum, int *vx, int *vy) {
|
||||
if (wNum >= SPRITEMAX) goto errexit;
|
||||
if (sact.sp[wNum]->type != SPRITE_MSG) goto errexit;
|
||||
|
||||
*vx = sact.sp[wNum]->u.msg.dspcur.x;
|
||||
*vy = sact.sp[wNum]->u.msg.dspcur.y;
|
||||
return OK;
|
||||
sprite_t *sp = sact.sp[wNum];
|
||||
if (sp->type != SPRITE_MSG) goto errexit;
|
||||
|
||||
*vx = sp->u.msg.dspcur.x + sp->loc.x;
|
||||
*vy = sp->u.msg.dspcur.y + sp->loc.y;
|
||||
return true;
|
||||
|
||||
errexit:
|
||||
*vx = 0;
|
||||
*vy = 0;
|
||||
return NG;
|
||||
return false;
|
||||
}
|
||||
|
||||
// NumeralXXXのCGのセット
|
||||
int sp_num_setcg(int nNum, int nIndex, int nCG) {
|
||||
sp_assert_no(nNum);
|
||||
void sp_num_setcg(int nNum, int nIndex, int nCG) {
|
||||
SP_ASSERT_NO(nNum);
|
||||
|
||||
sact.sp[nNum]->numeral.cg[nIndex] = nCG;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// NumeralXXXのCGの取得
|
||||
int sp_num_getcg(int nNum, int nIndex, int *vCG) {
|
||||
sp_assert_no(nNum);
|
||||
void sp_num_getcg(int nNum, int nIndex, int *vCG) {
|
||||
SP_ASSERT_NO(nNum);
|
||||
|
||||
*vCG = sact.sp[nNum]->numeral.cg[nIndex];
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// NumeralXXXの位置のセット
|
||||
int sp_num_setpos(int nNum, int nX, int nY) {
|
||||
sp_assert_no(nNum);
|
||||
void sp_num_setpos(int nNum, int nX, int nY) {
|
||||
SP_ASSERT_NO(nNum);
|
||||
|
||||
sact.sp[nNum]->numeral.pos.x = nX;
|
||||
sact.sp[nNum]->numeral.pos.y = nY;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// NumeralXXXの位置の取得
|
||||
int sp_num_getpos(int nNum, int *vX, int *vY) {
|
||||
sp_assert_no(nNum);
|
||||
void sp_num_getpos(int nNum, int *vX, int *vY) {
|
||||
SP_ASSERT_NO(nNum);
|
||||
|
||||
*vX = sact.sp[nNum]->numeral.pos.x;
|
||||
*vY = sact.sp[nNum]->numeral.pos.y;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// NumeralXXXのスパンのセット
|
||||
int sp_num_setspan(int nNum, int nSpan) {
|
||||
sp_assert_no(nNum);
|
||||
void sp_num_setspan(int nNum, int nSpan) {
|
||||
SP_ASSERT_NO(nNum);
|
||||
|
||||
sact.sp[nNum]->numeral.span = nSpan;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// NumeralXXXのスパンの取得
|
||||
int sp_num_getspan(int nNum, int *vSpan) {
|
||||
sp_assert_no(nNum);
|
||||
void sp_num_getspan(int nNum, int *vSpan) {
|
||||
SP_ASSERT_NO(nNum);
|
||||
|
||||
*vSpan = sact.sp[nNum]->numeral.span;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// すべての説明スプライトの削除
|
||||
int sp_exp_clear() {
|
||||
void sp_exp_clear(void) {
|
||||
SList *node;
|
||||
|
||||
for (node = sact.updatelist; node; node = node->next) {
|
||||
@@ -663,75 +596,65 @@ int sp_exp_clear() {
|
||||
if (sp == NULL) continue;
|
||||
sp_exp_del(sp->no);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 説明スプライトの登録
|
||||
int sp_exp_add(int nNumSP1, int nNumSP2) {
|
||||
void sp_exp_add(int nNumSP1, int nNumSP2) {
|
||||
sprite_t *swsp, *expsp;
|
||||
sp_assert_no(nNumSP1);
|
||||
sp_assert_no(nNumSP2);
|
||||
SP_ASSERT_NO(nNumSP1);
|
||||
SP_ASSERT_NO(nNumSP2);
|
||||
|
||||
swsp = sact.sp[nNumSP1];
|
||||
expsp = sact.sp[nNumSP2];
|
||||
|
||||
swsp->expsp = slist_append(swsp->expsp, expsp);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 説明スプライトの削除
|
||||
int sp_exp_del(int nNum) {
|
||||
void sp_exp_del(int nNum) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(nNum);
|
||||
SP_ASSERT_NO(nNum);
|
||||
|
||||
sp = sact.sp[nNum];
|
||||
|
||||
slist_free(sp->expsp);
|
||||
sp->expsp = NULL;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// スプライトサウンドのセット
|
||||
int sp_sound_set(int wNumSP, int wNumWave1, int wNumWave2, int wNumWave3) {
|
||||
void sp_sound_set(int wNumSP, int wNumWave1, int wNumWave2, int wNumWave3) {
|
||||
sprite_t *sp;
|
||||
|
||||
sp_assert_no(wNumSP);
|
||||
SP_ASSERT_NO(wNumSP);
|
||||
|
||||
sp = sact.sp[wNumSP];
|
||||
sp->numsound1 = wNumWave1;
|
||||
sp->numsound2 = wNumWave2;
|
||||
sp->numsound3 = wNumWave3;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// すべてのスプライトサウンドの終了を待つ
|
||||
int sp_sound_wait() {
|
||||
void sp_sound_wait(void) {
|
||||
WARNING("NOT IMPLEMENTED");
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 範囲外をクリックしたときのサウンドの設定
|
||||
int sp_sound_ob(int wNumWave) {
|
||||
void sp_sound_ob(int wNumWave) {
|
||||
sact.numsoundob = wNumWave;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定の座標が現在のスプライトの位置の範囲に入っているか?
|
||||
* @param sp: 調べる対象のスプライト
|
||||
* @param x,y: 座標
|
||||
* @return: TRUE:入っている, FALSE: 入っていない
|
||||
* @return: true:入っている, false: 入っていない
|
||||
*/
|
||||
boolean sp_is_insprite(sprite_t *sp, int x, int y) {
|
||||
bool sp_is_insprite(sprite_t *sp, int x, int y) {
|
||||
uint8_t *dp;
|
||||
|
||||
if (x < 0 || y < 0 || x >= sf0->width || y >= sf0->height) return FALSE;
|
||||
if (x < 0 || y < 0 || x >= main_surface->w || y >= main_surface->h) return false;
|
||||
|
||||
dp = GETOFFSET_PIXEL(sact.dmap, x, y);
|
||||
dp = PIXEL_AT(sact.dmap, x, y);
|
||||
return (*(uint16_t *)dp == sp->no);
|
||||
}
|
||||
|
||||
+81
-84
@@ -29,124 +29,121 @@
|
||||
#define DEFAULT_UPDATE sp_draw
|
||||
|
||||
// in sprite.c
|
||||
extern int sp_init();
|
||||
extern int sp_reset(void);
|
||||
extern int sp_new(int no, int cg1, int cg2, int cg3, int type);
|
||||
extern int sp_new_msg(int no, int x, int y, int width, int height);
|
||||
extern int sp_set_wall_paper(int no);
|
||||
extern int sp_free_all();
|
||||
extern int sp_free(int no);
|
||||
extern int sp_set_show(int no, int cnt, int flag);
|
||||
extern int sp_set_pos(int wNum, int wX, int wY);
|
||||
extern int sp_set_move(int wNum, int wX, int wY);
|
||||
extern int sp_set_movetime(int wNum, int wTime);
|
||||
extern int sp_set_movespeed(int wNum, int wTime);
|
||||
extern int sp_add_zkey_hidesprite(int wNum);
|
||||
extern int sp_clear_zkey_hidesprite_all();
|
||||
extern int sp_freeze_sprite(int wNum, int wIndex);
|
||||
extern int sp_thaw_sprite(int wNum);
|
||||
extern int sp_add_quakesprite(int wNum);
|
||||
extern int sp_clear_quakesprite_all();
|
||||
extern int sp_set_animeinterval(int wNum, int wTime);
|
||||
extern boolean sp_is_insprite(sprite_t *sp, int x, int y);
|
||||
extern int sp_set_blendrate(int wNum, int wCount, int rate);
|
||||
extern int sp_query_isexist(int wNum, int *ret);
|
||||
extern int sp_query_info(int wNum, int *vtype, int *vcg1, int *vcg2, int *vcg3);
|
||||
extern int sp_query_show(int wNum, int *vShow);
|
||||
extern int sp_query_pos(int wNum, int *vx, int *vy);
|
||||
extern int sp_query_size(int wNum, int *vw, int *vh);
|
||||
extern int sp_query_textpos(int wNum, int *vx, int *vy);
|
||||
extern int sp_num_setcg(int nNum, int nIndex, int nCG);
|
||||
extern int sp_num_getcg(int nNum, int nIndex, int *vCG);
|
||||
extern int sp_num_setpos(int nNum, int nX, int nY);
|
||||
extern int sp_num_getpos(int nNum, int *vX, int *vY);
|
||||
extern int sp_num_setspan(int nNum, int nSpan);
|
||||
extern int sp_num_getspan(int nNUm, int *vSpan);
|
||||
extern int sp_exp_clear();
|
||||
extern int sp_exp_add(int nNumSP1, int nNumSP2);
|
||||
extern int sp_exp_del(int wNum);
|
||||
extern int sp_sound_set(int wNumSP, int wNumWave1, int wNumWave2, int wNumWave3);
|
||||
extern int sp_sound_wait();
|
||||
extern int sp_sound_ob(int wNumWave);
|
||||
void sp_init(void);
|
||||
void sp_reset(void);
|
||||
void sp_new(int no, int cg1, int cg2, int cg3, int type);
|
||||
void sp_new_msg(int no, int x, int y, int width, int height);
|
||||
void sp_set_wall_paper(int no);
|
||||
void sp_free_all(void);
|
||||
void sp_free(int no);
|
||||
void sp_set_show(int no, int cnt, int flag);
|
||||
void sp_set_pos(int wNum, int wX, int wY);
|
||||
void sp_set_move(int wNum, int wX, int wY);
|
||||
void sp_set_movetime(int wNum, int wTime);
|
||||
void sp_set_movespeed(int wNum, int wTime);
|
||||
void sp_add_zkey_hidesprite(int wNum);
|
||||
void sp_clear_zkey_hidesprite_all(void);
|
||||
void sp_freeze_sprite(int wNum, int wIndex);
|
||||
void sp_thaw_sprite(int wNum);
|
||||
void sp_add_quakesprite(int wNum);
|
||||
void sp_clear_quakesprite_all(void);
|
||||
void sp_set_animeinterval(int wNum, int wTime);
|
||||
bool sp_is_insprite(sprite_t *sp, int x, int y);
|
||||
void sp_set_blendrate(int wNum, int wCount, int rate);
|
||||
bool sp_exists(int wNum);
|
||||
bool sp_query_info(int wNum, int *vtype, int *vcg1, int *vcg2, int *vcg3);
|
||||
bool sp_query_show(int wNum, int *vShow);
|
||||
bool sp_query_pos(int wNum, int *vx, int *vy);
|
||||
bool sp_query_size(int wNum, int *vw, int *vh);
|
||||
bool sp_query_textpos(int wNum, int *vx, int *vy);
|
||||
void sp_num_setcg(int nNum, int nIndex, int nCG);
|
||||
void sp_num_getcg(int nNum, int nIndex, int *vCG);
|
||||
void sp_num_setpos(int nNum, int nX, int nY);
|
||||
void sp_num_getpos(int nNum, int *vX, int *vY);
|
||||
void sp_num_setspan(int nNum, int nSpan);
|
||||
void sp_num_getspan(int nNUm, int *vSpan);
|
||||
void sp_exp_clear(void);
|
||||
void sp_exp_add(int nNumSP1, int nNumSP2);
|
||||
void sp_exp_del(int wNum);
|
||||
void sp_sound_set(int wNumSP, int wNumWave1, int wNumWave2, int wNumWave3);
|
||||
void sp_sound_wait(void);
|
||||
void sp_sound_ob(int wNumWave);
|
||||
|
||||
|
||||
// in sprite_update.c
|
||||
extern int sp_update_all(boolean syncscreen);
|
||||
extern int sp_update_clipped();
|
||||
extern int sp_updateme(sprite_t *sp);
|
||||
extern int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h);
|
||||
void sp_update_all(bool syncscreen);
|
||||
void sp_update_clipped();
|
||||
void sp_updateme(sprite_t *sp);
|
||||
void sp_updateme_part(sprite_t *sp, int x, int y, int w, int h);
|
||||
|
||||
|
||||
// in sprite_draw.c
|
||||
extern int sp_draw(sprite_t *sf);
|
||||
extern int sp_draw2(sprite_t *sf, cginfo_t *cg);
|
||||
extern void sp_draw_dmap(void* data, void* userdata);
|
||||
void sp_draw(sprite_t *sf);
|
||||
void sp_draw_dmap(void* data, void* userdata);
|
||||
|
||||
|
||||
// in sprite_msg.c
|
||||
extern void smsg_add(const char *msg);
|
||||
extern void smsg_newline(int wNum, int size);
|
||||
extern void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wFont, int wSpeed, int wLineSpace, int wAlign, int wRSize, int wRFont, int wRLineSpace, int *wLength);
|
||||
extern void smsg_clear(int wNum);
|
||||
extern int smsg_is_empty();
|
||||
extern int smsg_keywait(int sp1, int sp2, int timeout);
|
||||
extern int smsg_update(sprite_t *sp);
|
||||
void smsg_add(const char *msg);
|
||||
void smsg_newline(int wNum, int size);
|
||||
void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wFont, int wSpeed, int wLineSpace, int wAlign, int wRSize, int wRFont, int wRLineSpace, int *wLength);
|
||||
void smsg_clear(int wNum);
|
||||
bool smsg_is_empty();
|
||||
int smsg_peek(int nTopStringNum);
|
||||
int smsg_keywait(int sp1, int sp2, int timeout);
|
||||
void smsg_update(sprite_t *sp);
|
||||
|
||||
// in sprite_sel.c
|
||||
extern void ssel_init();
|
||||
extern void ssel_reset(void);
|
||||
extern void ssel_clear();
|
||||
extern void ssel_add(int nString, int wI);
|
||||
extern int ssel_select(int wNum, int wChoiceSize, int wMenuOutSpc, int wChoiceLineSpace, int wChoiceAutoMoveCursor, int nAlign);
|
||||
void ssel_init();
|
||||
void ssel_reset(void);
|
||||
void ssel_clear();
|
||||
void ssel_add(int nString, int wI);
|
||||
int ssel_select(int wNum, int wChoiceSize, int wMenuOutSpc, int wChoiceLineSpace, int wChoiceAutoMoveCursor, int nAlign);
|
||||
|
||||
// in sprite_event.c
|
||||
extern void spev_callback(agsevent_t *e);
|
||||
extern void spev_add_eventlistener(sprite_t *sp, int (*cb)(sprite_t *, agsevent_t *));
|
||||
extern void spev_remove_eventlistener(sprite_t *sp);
|
||||
void spev_callback(agsevent_t *e);
|
||||
void spev_add_eventlistener(sprite_t *sp, int (*cb)(sprite_t *, agsevent_t *));
|
||||
void spev_remove_eventlistener(sprite_t *sp);
|
||||
|
||||
// in sprite_tevent.c
|
||||
extern void spev_add_teventlistener(sprite_t *sp, int (*cb)(sprite_t *, agsevent_t *));
|
||||
extern void spev_remove_teventlistener(sprite_t *sp);
|
||||
extern void spev_main();
|
||||
void spev_add_teventlistener(sprite_t *sp, int (*cb)(sprite_t *, agsevent_t *));
|
||||
void spev_remove_teventlistener(sprite_t *sp);
|
||||
void spev_main();
|
||||
|
||||
// in sprite_move.c
|
||||
extern void spev_move_setup(void* data, void* userdata);
|
||||
extern void spev_move_waitend(sprite_t *sp, int dx, int dy, int time);
|
||||
extern void spev_wait4moving_sp();
|
||||
void spev_move_setup(void* data, void* userdata);
|
||||
void spev_move_waitend(sprite_t *sp, int dx, int dy, int time);
|
||||
void spev_wait4moving_sp();
|
||||
|
||||
// in sprite_switch.c
|
||||
extern int sp_sw_setup(sprite_t *sp);
|
||||
void sp_sw_setup(sprite_t *sp);
|
||||
|
||||
// in sprite_get.c
|
||||
extern int sp_get_setup(sprite_t *sp);
|
||||
void sp_get_setup(sprite_t *sp);
|
||||
|
||||
// in sprite_put.c
|
||||
extern int sp_put_setup(sprite_t *sp);
|
||||
void sp_put_setup(sprite_t *sp);
|
||||
|
||||
// in sprite_anime.c
|
||||
extern int sp_anime_setup(sprite_t *sp);
|
||||
void sp_anime_setup(sprite_t *sp);
|
||||
|
||||
// in sprite_eupdate.c
|
||||
extern int sp_eupdate(int type, int time, int key);
|
||||
void sp_eupdate(int type, int time, int key);
|
||||
|
||||
// in sprite_quake.c
|
||||
extern int sp_quake_sprite(int wType, int wAmplitudeX, int wAmplitude, int wCount, int cancel);
|
||||
void sp_quake_sprite(int wType, int wAmplitudeX, int wAmplitude, int wCount, int cancel);
|
||||
|
||||
// in sprite_keywait.c
|
||||
extern int sp_keywait(int *vOK, int *vRND, int *vRsv1, int *vRsv2, int *vRsv3, int timeout);
|
||||
void sp_keywait(int *vOK, int *vRND, int *vRsv1, int *vRsv2, int *vRsv3, int timeout);
|
||||
|
||||
// in screen_quake.c
|
||||
extern int sp_quake_screen(int type, int p1, int p2, int time, int cancel);
|
||||
|
||||
// in sactamask.c
|
||||
extern int sp_eupdate_amap(int type, int time, int key);
|
||||
void sp_quake_screen(int type, int p1, int p2, int time, int cancel);
|
||||
|
||||
// in sprite_xmenu.c
|
||||
extern int spxm_clear(void);
|
||||
extern int spxm_register(int reginum, int menuid);
|
||||
extern int spxm_getnum(int reginum);
|
||||
extern int spxm_gettext(int regnum, int strno);
|
||||
extern int spxm_titlereg(void);
|
||||
extern int spxm_titleget(int strno);
|
||||
void spxm_clear(void);
|
||||
void spxm_register(int reginum, int menuid);
|
||||
int spxm_getnum(int reginum);
|
||||
void spxm_gettext(int regnum, int strno);
|
||||
void spxm_titlereg(void);
|
||||
void spxm_titleget(int strno);
|
||||
|
||||
#endif /* __SPRITE_H__ */
|
||||
|
||||
@@ -81,7 +81,7 @@ static void cb_remove(sprite_t *sp) {
|
||||
sp_new の時にスプライトの種類毎の初期化
|
||||
@param sp: 初期化するスプライト
|
||||
*/
|
||||
int sp_anime_setup(sprite_t *sp) {
|
||||
void sp_anime_setup(sprite_t *sp) {
|
||||
int n = 0;
|
||||
|
||||
sp->u.anime.interval = 500; // デフォルトの間隔 0.5秒
|
||||
@@ -96,6 +96,4 @@ int sp_anime_setup(sprite_t *sp) {
|
||||
|
||||
spev_add_teventlistener(sp, eventCB_ANIM);
|
||||
sp->remove = cb_remove;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
+44
-102
@@ -23,55 +23,32 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "ags.h"
|
||||
#include "graphics.h"
|
||||
#include "sact.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "sprite.h"
|
||||
|
||||
static void fill_dmap(int dx ,int dy, int w, int h, uint16_t val);
|
||||
static void fill_dmap_mask(surface_t *src, int sx, int sy, int dx ,int dy, int w, int h, uint16_t val);
|
||||
|
||||
|
||||
|
||||
// 矩形の depthmap を描画
|
||||
static void fill_dmap(int dx ,int dy, int w, int h, uint16_t val) {
|
||||
uint8_t *dp, *dp_;
|
||||
int x, y;
|
||||
|
||||
dp = dp_ = (GETOFFSET_PIXEL(sact.dmap, dx, dy));
|
||||
|
||||
for (x = 0; x < w; x++) {
|
||||
*((uint16_t *)dp + x) = val;
|
||||
}
|
||||
dp += sact.dmap->bytes_per_line;
|
||||
|
||||
for (y = 1; y < h; y++) {
|
||||
memcpy(dp, dp_, w * 2);
|
||||
dp += sact.dmap->bytes_per_line;
|
||||
}
|
||||
}
|
||||
|
||||
// alphamapにしたがって、alpha値が0より大きいところを指定のdepthとする
|
||||
static void fill_dmap_mask(surface_t *src, int sx, int sy, int dx ,int dy, int w, int h, uint16_t val) {
|
||||
static void fill_dmap_mask(SDL_Surface *src, int sx, int sy, int dx ,int dy, int w, int h, uint16_t val) {
|
||||
uint8_t *sp, *dp;
|
||||
int x, y;
|
||||
|
||||
dp = GETOFFSET_PIXEL(sact.dmap, dx, dy);
|
||||
sp = GETOFFSET_ALPHA(src, sx, sy);
|
||||
assert(src->format->Amask == 0xff000000);
|
||||
dp = PIXEL_AT(sact.dmap, dx, dy);
|
||||
sp = ALPHA_AT(src, sx, sy);
|
||||
|
||||
for (y = 0; y < h; y++) {
|
||||
uint8_t *yls = (uint8_t *)(sp + y * src->width);
|
||||
uint16_t *yld = (uint16_t *)(dp + y * sact.dmap->bytes_per_line);
|
||||
uint8_t *yls = sp + y * src->pitch;
|
||||
uint16_t *yld = (uint16_t *)(dp + y * sact.dmap->pitch);
|
||||
for (x = 0; x < w; x++) {
|
||||
if (*yls > 0) *yld = val;
|
||||
yls++; yld++;
|
||||
yls += 4; yld++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,66 +57,34 @@ static void fill_dmap_mask(surface_t *src, int sx, int sy, int dx ,int dy, int w
|
||||
指定の sprite (の現在のCG)を surface0 に書く
|
||||
@param sp: 描画するスプライト
|
||||
*/
|
||||
int sp_draw(sprite_t *sp) {
|
||||
if (sp == NULL) return NG;
|
||||
|
||||
return sp_draw2(sp, sp->curcg);
|
||||
}
|
||||
|
||||
/*
|
||||
指定の spriteの指定のCGを surface0 に書く
|
||||
(このインターフェイスはもう不要?)
|
||||
|
||||
@param sp: 描画するスプライト
|
||||
@param cg: 描画するCG
|
||||
*/
|
||||
int sp_draw2(sprite_t *sp, cginfo_t *cg) {
|
||||
surface_t update;
|
||||
int sx, sy, w, h, dx, dy;
|
||||
|
||||
if (cg == NULL) return NG;
|
||||
if (cg->sf == NULL) return NG;
|
||||
void sp_draw(sprite_t *sp) {
|
||||
if (sp == NULL) return;
|
||||
cginfo_t *cg = sp->curcg;
|
||||
if (cg == NULL) return;
|
||||
if (cg->sf == NULL) return;
|
||||
|
||||
// 更新領域の確定
|
||||
update.width = sact.updaterect.w;
|
||||
update.height = sact.updaterect.h;
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
dx = sp->cur.x - sact.updaterect.x;
|
||||
dy = sp->cur.y - sact.updaterect.y;
|
||||
w = cg->sf->width;
|
||||
h = cg->sf->height;
|
||||
|
||||
if (!gr_clip(cg->sf, &sx, &sy, &w, &h, &update, &dx, &dy)) {
|
||||
return NG;
|
||||
SDL_Rect cg_rect = {0, 0, cg->sf->w, cg->sf->h};
|
||||
int sx = 0;
|
||||
int sy = 0;
|
||||
int dx = sp->cur.x;
|
||||
int dy = sp->cur.y;
|
||||
int w = cg->sf->w;
|
||||
int h = cg->sf->h;
|
||||
|
||||
if (!ags_clipCopyRect(&cg_rect, &sact.updaterect, &sx, &sy, &dx, &dy, &w, &h)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dx += sact.updaterect.x;
|
||||
dy += sact.updaterect.y;
|
||||
|
||||
if (cg->sf->alpha) {
|
||||
// alpha map がある場合
|
||||
gre_BlendUseAMap(sf0, dx, dy,
|
||||
sf0, dx, dy,
|
||||
cg->sf, sx, sy, w, h,
|
||||
cg->sf, sx, sy,
|
||||
sp->blendrate);
|
||||
|
||||
if (SDL_ISPIXELFORMAT_ALPHA(cg->sf->format->format) || sp->blendrate < 255) {
|
||||
SDL_SetSurfaceBlendMode(cg->sf, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetSurfaceAlphaMod(cg->sf, sp->blendrate);
|
||||
} else {
|
||||
if (sp->blendrate == 255) {
|
||||
// alpha値指定が無い場合
|
||||
gr_copy(sf0, dx, dy, cg->sf, sx, sy, w, h);
|
||||
} else if (sp->blendrate > 0) {
|
||||
// alpha値指定がある場合
|
||||
gre_Blend(sf0, dx, dy,
|
||||
sf0, dx, dy,
|
||||
cg->sf, sx, sy, w, h,
|
||||
sp->blendrate);
|
||||
}
|
||||
SDL_SetSurfaceBlendMode(cg->sf, SDL_BLENDMODE_NONE);
|
||||
}
|
||||
SDL_BlitSurface(cg->sf, &(SDL_Rect){sx, sy, w, h}, main_surface, &(SDL_Rect){dx, dy, w, h});
|
||||
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d", sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -147,38 +92,35 @@ int sp_draw2(sprite_t *sp, cginfo_t *cg) {
|
||||
*/
|
||||
void sp_draw_dmap(void* data, void* userdata) {
|
||||
sprite_t *sp = (sprite_t *)data;
|
||||
cginfo_t *cg;
|
||||
surface_t update;
|
||||
int sx, sy, w, h, dx, dy;
|
||||
|
||||
|
||||
// 非表示状態の時は無視
|
||||
if (!sp->show) return;
|
||||
|
||||
// ドラッグ中のスプライトは無視
|
||||
if (sp == sact.draggedsp) return;
|
||||
|
||||
cg = sp->curcg;
|
||||
cginfo_t *cg = sp->curcg;
|
||||
if (cg == NULL) return;
|
||||
if (cg->sf == NULL) return;
|
||||
|
||||
// depth map を書く領域を確定
|
||||
update.width = sf0->width;
|
||||
update.height = sf0->height;
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
dx = sp->cur.x;
|
||||
dy = sp->cur.y;
|
||||
w = cg->sf->width;
|
||||
h = cg->sf->height;
|
||||
|
||||
if (!gr_clip(cg->sf, &sx, &sy, &w, &h, &update, &dx, &dy)) {
|
||||
SDL_Rect cg_rect = {0, 0, cg->sf->w, cg->sf->h};
|
||||
SDL_Rect screen_rect = {0, 0, main_surface->w, main_surface->h};
|
||||
int sx = 0;
|
||||
int sy = 0;
|
||||
int dx = sp->cur.x;
|
||||
int dy = sp->cur.y;
|
||||
int w = cg->sf->w;
|
||||
int h = cg->sf->h;
|
||||
|
||||
if (!ags_clipCopyRect(&cg_rect, &screen_rect, &sx, &sy, &dx, &dy, &w, &h)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cg->sf->alpha) {
|
||||
if (SDL_ISPIXELFORMAT_ALPHA(cg->sf->format->format)) {
|
||||
fill_dmap_mask(cg->sf, sx, sy, dx, dy, w, h, sp->no);
|
||||
} else {
|
||||
fill_dmap(dx, dy, w, h, sp->no);
|
||||
SDL_FillRect(sact.dmap, &(SDL_Rect){dx, dy, w, h}, sp->no);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include "portab.h"
|
||||
#include "system.h"
|
||||
#include "ngraph.h"
|
||||
#include "ags.h"
|
||||
#include "input.h"
|
||||
#include "sact.h"
|
||||
@@ -38,20 +37,20 @@
|
||||
@param time: 実行時間
|
||||
@param cancel: キー抜け(0:なし, 1:あり)
|
||||
*/
|
||||
int sp_eupdate(int type, int time, int cancel) {
|
||||
void sp_eupdate(int type, int time, int cancel) {
|
||||
if (sact.waitskiplv > 1) {
|
||||
sp_update_all(TRUE);
|
||||
return OK;
|
||||
sp_update_all(true);
|
||||
return;
|
||||
}
|
||||
|
||||
sp_update_all(FALSE);
|
||||
sp_update_all(false);
|
||||
|
||||
enum sdl_effect_type sdl_effect = from_sact_effect(type);
|
||||
if (sdl_effect == EFFECT_INVALID) {
|
||||
WARNING("Unimplemented effect %d", type);
|
||||
type = EFFECT_CROSSFADE;
|
||||
}
|
||||
SDL_Rect rect = { 0, 0, sf0->width, sf0->height };
|
||||
SDL_Rect rect = { 0, 0, main_surface->w, main_surface->h };
|
||||
struct sdl_effect *eff = sdl_effect_init(&rect, NULL, 0, 0, sdl_getDIB(), 0, 0, sdl_effect);
|
||||
|
||||
int sttime, curtime;
|
||||
@@ -67,5 +66,4 @@ int sp_eupdate(int type, int time, int cancel) {
|
||||
}
|
||||
sdl_effect_finish(eff);
|
||||
ags_updateFull();
|
||||
return OK;
|
||||
}
|
||||
|
||||
+16
-16
@@ -91,11 +91,11 @@ static void cb_waitkey_selection(agsevent_t *e);
|
||||
static void cb_focused_swsp(void* s, void* data) {
|
||||
sprite_t *sp = (sprite_t *)s;
|
||||
int *update = (int *)data;
|
||||
boolean oldstate = sp->show;
|
||||
bool oldstate = sp->show;
|
||||
|
||||
SACT_DEBUG("show up spex %d", sp->no);
|
||||
|
||||
sp->show = TRUE;
|
||||
sp->show = true;
|
||||
if (oldstate != sp->show) {
|
||||
(*update)++;
|
||||
sp_updateme(sp);
|
||||
@@ -109,11 +109,11 @@ static void cb_focused_swsp(void* s, void* data) {
|
||||
static void cb_defocused_swsp(void* s, void* data) {
|
||||
sprite_t *sp = (sprite_t *)s;
|
||||
int *update = (int *)data;
|
||||
boolean oldstate = sp->show;
|
||||
bool oldstate = sp->show;
|
||||
|
||||
SACT_DEBUG("hide spex %d", sp->no);
|
||||
|
||||
sp->show = FALSE;
|
||||
sp->show = false;
|
||||
if (oldstate != sp->show) {
|
||||
(*update)++;
|
||||
sp_updateme(sp);
|
||||
@@ -124,7 +124,7 @@ static void cb_defocused_swsp(void* s, void* data) {
|
||||
static void cb_focused_zkey(void* s, void* data) {
|
||||
sprite_t *sp = (sprite_t *)s;
|
||||
int *update = (int *)data;
|
||||
boolean oldstate = sp->show;
|
||||
bool oldstate = sp->show;
|
||||
|
||||
sp->show = sp->show_save;
|
||||
if (oldstate != sp->show) {
|
||||
@@ -137,9 +137,9 @@ static void cb_focused_zkey(void* s, void* data) {
|
||||
static void cb_defocused_zkey(void* s, void* data) {
|
||||
sprite_t *sp = (sprite_t *)s;
|
||||
int *update = (int *)data;
|
||||
boolean oldstate = sp->show;
|
||||
bool oldstate = sp->show;
|
||||
|
||||
sp->show = FALSE;
|
||||
sp->show = false;
|
||||
if (oldstate != sp->show) {
|
||||
(*update)++;
|
||||
sp_updateme(sp);
|
||||
@@ -174,7 +174,7 @@ static int cb_focused(sprite_t *sp) {
|
||||
sp->curcg = sp->cg2;
|
||||
update++;
|
||||
}
|
||||
sp->focused = TRUE;
|
||||
sp->focused = true;
|
||||
SACT_DEBUG("get forcused %d, type %d", sp->no, sp->type);
|
||||
if (sp->numsound1) {
|
||||
ssnd_play(sp->numsound1);
|
||||
@@ -197,7 +197,7 @@ static int cb_defocused(sprite_t *sp) {
|
||||
}
|
||||
sp->curcg = sp->cg1;
|
||||
update++;
|
||||
sp->focused = FALSE;
|
||||
sp->focused = false;
|
||||
SACT_DEBUG("lost forcused %d", sp->no);
|
||||
}
|
||||
|
||||
@@ -216,11 +216,11 @@ static void cb_waitkey_simple(agsevent_t *e) {
|
||||
cur = sdl_getTicks();
|
||||
if (!sact.zhiding) {
|
||||
slist_foreach(sact.sp_zhide, cb_defocused_zkey, &update);
|
||||
sact.zhiding = TRUE;
|
||||
sact.zdooff = TRUE;
|
||||
sact.zhiding = true;
|
||||
sact.zdooff = true;
|
||||
sact.zofftime = cur;
|
||||
} else {
|
||||
sact.zdooff = FALSE;
|
||||
sact.zdooff = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -229,14 +229,14 @@ static void cb_waitkey_simple(agsevent_t *e) {
|
||||
// back log view mode に移行
|
||||
// MessageKey 待ちのときのみ
|
||||
if (sact.waittype != KEYWAIT_MESSAGE) break;
|
||||
if (sblog_start() == OK)
|
||||
if (sblog_start())
|
||||
sact.waittype = KEYWAIT_BACKLOG;
|
||||
break;
|
||||
|
||||
case AGSEVENT_BUTTON_RELEASE:
|
||||
if (sact.zhiding) {
|
||||
slist_foreach(sact.sp_zhide, cb_focused_zkey, &update);
|
||||
sact.zhiding = FALSE;
|
||||
sact.zhiding = false;
|
||||
}
|
||||
// fall through
|
||||
|
||||
@@ -246,14 +246,14 @@ static void cb_waitkey_simple(agsevent_t *e) {
|
||||
cur = sdl_getTicks();
|
||||
if (500 < (cur - sact.zofftime) || !sact.zdooff) {
|
||||
slist_foreach(sact.sp_zhide, cb_focused_zkey, &update);
|
||||
sact.zhiding = FALSE;
|
||||
sact.zhiding = false;
|
||||
}
|
||||
break;
|
||||
case KEY_PAGEUP:
|
||||
case KEY_PAGEDOWN:
|
||||
// MessageKey 待ちのときのみ
|
||||
if (sact.waittype != KEYWAIT_MESSAGE) break;
|
||||
if (sblog_start() == OK)
|
||||
if (sblog_start())
|
||||
sact.waittype = KEYWAIT_BACKLOG;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -42,9 +42,9 @@ static void cb_remove(sprite_t *sp);
|
||||
static void cb_defocused_swsp(void* s, void* data) {
|
||||
sprite_t *sp = (sprite_t *)s;
|
||||
int *update = (int *)data;
|
||||
boolean oldstate = sp->show;
|
||||
bool oldstate = sp->show;
|
||||
|
||||
sp->show = FALSE;
|
||||
sp->show = false;
|
||||
if (oldstate != sp->show) {
|
||||
(*update)++;
|
||||
sp_updateme(sp);
|
||||
@@ -61,7 +61,7 @@ static int eventCB_GET(sprite_t *sp, agsevent_t *e) {
|
||||
if (e->code != AGSEVENT_BUTTON_LEFT) break;
|
||||
|
||||
// drag開始時のマウスの位置記録
|
||||
sp->u.get.dragging = TRUE;
|
||||
sp->u.get.dragging = true;
|
||||
sp->u.get.dragstart.x = e->mousex;
|
||||
sp->u.get.dragstart.y = e->mousey;
|
||||
|
||||
@@ -73,7 +73,7 @@ static int eventCB_GET(sprite_t *sp, agsevent_t *e) {
|
||||
|
||||
// スプライトの表示を一番前に持って来る
|
||||
sact.draggedsp = sp;
|
||||
sact.dropped = FALSE;
|
||||
sact.dropped = false;
|
||||
|
||||
// 説明スプライトがある場合は、それを非表示にする
|
||||
if (sp->expsp) {
|
||||
@@ -92,7 +92,7 @@ static int eventCB_GET(sprite_t *sp, agsevent_t *e) {
|
||||
|
||||
if (!sp->u.get.dragging) break;
|
||||
|
||||
sact.dropped = TRUE;
|
||||
sact.dropped = true;
|
||||
break;
|
||||
|
||||
case AGSEVENT_MOUSE_MOTION:
|
||||
@@ -128,10 +128,8 @@ static void cb_remove(sprite_t *sp) {
|
||||
sp_new の時にスプライトの種類毎の初期化
|
||||
@param sp: 初期化するスプライト
|
||||
*/
|
||||
int sp_get_setup(sprite_t *sp) {
|
||||
void sp_get_setup(sprite_t *sp) {
|
||||
spev_add_eventlistener(sp, eventCB_GET);
|
||||
sp->remove = cb_remove;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,15 +33,13 @@
|
||||
#include "ags.h"
|
||||
#include "nact.h"
|
||||
#include "input.h"
|
||||
#include "ngraph.h"
|
||||
#include "surface.h"
|
||||
#include "sact.h"
|
||||
#include "sprite.h"
|
||||
#include "sactsound.h"
|
||||
|
||||
|
||||
static void hidesprite(sprite_t *sp);
|
||||
static boolean waitcond(int endtime);
|
||||
static bool waitcond(int endtime);
|
||||
|
||||
|
||||
|
||||
@@ -57,23 +55,23 @@ static void hidesprite(sprite_t *sp) {
|
||||
}
|
||||
|
||||
sp_updateme(sp);
|
||||
sp->show = FALSE;
|
||||
sp->show = false;
|
||||
sp_update_clipped();
|
||||
}
|
||||
|
||||
/*
|
||||
キー待ち終了の条件チェック
|
||||
@param endtime: 終了時間
|
||||
@return: 終了なら TRUE、継続なら FALSE
|
||||
@return: 終了なら true、継続なら false
|
||||
|
||||
スプライトがドロップされた時の各種処理を含む
|
||||
*/
|
||||
static boolean waitcond(int endtime) {
|
||||
static bool waitcond(int endtime) {
|
||||
int curtime = sdl_getTicks();
|
||||
if (curtime >= endtime) return TRUE;
|
||||
if (curtime >= endtime) return true;
|
||||
|
||||
if (sact.dropped) {
|
||||
sact.draggedsp->u.get.dragging = FALSE;
|
||||
sact.draggedsp->u.get.dragging = false;
|
||||
if (sact.waitkey != -1) {
|
||||
// dropしたスプライトをじわじわ消す
|
||||
hidesprite(sact.draggedsp);
|
||||
@@ -81,8 +79,8 @@ static boolean waitcond(int endtime) {
|
||||
sact.sp_result_put = sact.waitkey;
|
||||
sp_free(sact.draggedsp->no);
|
||||
sact.draggedsp = NULL;
|
||||
sact.dropped = FALSE;
|
||||
return TRUE;
|
||||
sact.dropped = false;
|
||||
return true;
|
||||
} else {
|
||||
// PUT/SWPUTスプライト以外のところにdropした場合
|
||||
sprite_t *sp = sact.draggedsp;
|
||||
@@ -99,12 +97,12 @@ static boolean waitcond(int endtime) {
|
||||
ssnd_play(sact.draggedsp->numsound3);
|
||||
}
|
||||
sact.draggedsp = NULL;
|
||||
sact.dropped = FALSE;
|
||||
sact.dropped = false;
|
||||
}
|
||||
}
|
||||
|
||||
// その他キー入力があれば終了
|
||||
return sact.waitkey == -1 ? FALSE : TRUE;
|
||||
return sact.waitkey != -1;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -116,11 +114,11 @@ static boolean waitcond(int endtime) {
|
||||
@param vD03: タイムアウトした場合=1, しない場合=0
|
||||
@param wTime: タイムアウト時間 (1/100sec)
|
||||
*/
|
||||
int sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout) {
|
||||
void sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout) {
|
||||
int curtime, endtime;
|
||||
|
||||
// とりあえず全更新
|
||||
sp_update_all(TRUE);
|
||||
sp_update_all(true);
|
||||
|
||||
// depthmap を準備
|
||||
slist_foreach(sact.updatelist, sp_draw_dmap, NULL);
|
||||
@@ -136,7 +134,7 @@ int sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout
|
||||
// とりあえず、現在のマウス位置を送って、switch sprite の
|
||||
// 状態を更新しておく
|
||||
MyPoint p;
|
||||
sys_getMouseInfo(&p, FALSE);
|
||||
sys_getMouseInfo(&p, false);
|
||||
agsevent_t agse = {
|
||||
.type = AGSEVENT_MOUSE_MOTION,
|
||||
.mousex = p.x,
|
||||
@@ -172,8 +170,6 @@ int sp_keywait(int *vOK, int *vRND, int *vD01, int *vD02, int *vD03, int timeout
|
||||
*vD02 = sact.sp_result_put;
|
||||
|
||||
sact.waittype = KEYWAIT_NONE;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ static void move_drain(sprite_t *sp) {
|
||||
// 後で、movelist から外してもらうための処理
|
||||
sact.teventremovelist = slist_append(sact.teventremovelist, sp);
|
||||
|
||||
sp->move.moving = FALSE;
|
||||
sp->move.moving = false;
|
||||
if (sp->move.speed > 0)
|
||||
sp->move.time = 0;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ void spev_move_setup(void* data, void* userdata) {
|
||||
|
||||
// move 開始時刻の記録
|
||||
sp->move.starttime = sact.movestarttime;
|
||||
sp->move.moving = TRUE;
|
||||
sp->move.moving = true;
|
||||
|
||||
// MOVE_SPEED で設定した場合は、移動量を考慮して移動時間を決定
|
||||
if (sp->move.speed > 0) {
|
||||
|
||||
+50
-52
@@ -35,7 +35,6 @@
|
||||
#include "input.h"
|
||||
#include "sact.h"
|
||||
#include "sprite.h"
|
||||
#include "ngraph.h"
|
||||
#include "drawtext.h"
|
||||
#include "sactlog.h"
|
||||
|
||||
@@ -46,7 +45,7 @@ struct markinfo {
|
||||
int interval;
|
||||
};
|
||||
|
||||
static boolean is_messagesprite(int wNum);
|
||||
static bool is_messagesprite(int wNum);
|
||||
static void replacestr_cb(void* data, void* userdata);
|
||||
static char *replacestr(char *msg);
|
||||
static void update_mark(sprite_t *sp, cginfo_t *cg);
|
||||
@@ -65,17 +64,17 @@ static char *replacesrc;
|
||||
static char *replacedst;
|
||||
|
||||
// 指定の番号のスプライトがメッセージスプライトかどうかをチェック
|
||||
static boolean is_messagesprite(int wNum) {
|
||||
static bool is_messagesprite(int wNum) {
|
||||
// check sprite number is sane
|
||||
if (wNum >= (SPRITEMAX -1) || wNum <= 0) return FALSE;
|
||||
if (wNum >= (SPRITEMAX -1) || wNum <= 0) return false;
|
||||
|
||||
// check sprite is set
|
||||
if (sact.sp[wNum] == NULL) return FALSE;
|
||||
if (sact.sp[wNum] == NULL) return false;
|
||||
|
||||
// check sprite is message sprite
|
||||
if (sact.sp[wNum]->type != SPRITE_MSG) return FALSE;
|
||||
if (sact.sp[wNum]->type != SPRITE_MSG) return false;
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 文字列の置き換え処理
|
||||
@@ -88,7 +87,7 @@ static void replacestr_cb(void* data, void* userdata) {
|
||||
start = replacesrc;
|
||||
out = replacedst;
|
||||
|
||||
while (TRUE) {
|
||||
while (true) {
|
||||
next = strstr(start, ex->src);
|
||||
if (next == NULL) break;
|
||||
strncat(out, start, (size_t)(next - start));
|
||||
@@ -118,10 +117,10 @@ static char *replacestr(char *msg) {
|
||||
|
||||
// アニメパターンの描画
|
||||
static void update_mark(sprite_t *sp, cginfo_t *cg) {
|
||||
boolean show = sp->show;
|
||||
bool show = sp->show;
|
||||
cginfo_t *curcg = sp->curcg;
|
||||
|
||||
sp->show = TRUE;
|
||||
sp->show = true;
|
||||
sp->curcg = cg;
|
||||
|
||||
sp_updateme(sp);
|
||||
@@ -241,7 +240,7 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
char *msg;
|
||||
sprite_t *sp;
|
||||
int len = 0; // 処理した文字数?
|
||||
boolean needupdate = FALSE;
|
||||
bool needupdate = false;
|
||||
MyRectangle uparea = {0,0,0,0};
|
||||
|
||||
// wRSize == 0 -> ルビ無し(SACT.MessageOutputからの呼出)
|
||||
@@ -303,7 +302,7 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
mbuf,
|
||||
wColorR, wColorG, wColorB);
|
||||
|
||||
needupdate = TRUE;
|
||||
needupdate = true;
|
||||
|
||||
append_to_log(mbuf);
|
||||
|
||||
@@ -314,7 +313,7 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
cw,
|
||||
wSize + wRSize + wRLineSpace);
|
||||
sp_update_clipped();
|
||||
needupdate = FALSE;
|
||||
needupdate = false;
|
||||
|
||||
// keywait
|
||||
delta = sdl_getTicks() - wcnt;
|
||||
@@ -352,24 +351,19 @@ void smsg_out(int wNum, int wSize, int wColorR, int wColorG, int wColorB, int wF
|
||||
@param wNum: クリアするスプライト番号
|
||||
*/
|
||||
void smsg_clear(int wNum) {
|
||||
sprite_t *sp;
|
||||
surface_t *sf;
|
||||
|
||||
if (!is_messagesprite(wNum)) return;
|
||||
|
||||
// 表示位置の初期化
|
||||
sp = sact.sp[wNum];
|
||||
sprite_t *sp = sact.sp[wNum];
|
||||
sp->u.msg.dspcur.x = 0;
|
||||
sp->u.msg.dspcur.y = 0;
|
||||
|
||||
sact.msgbuf[0] = '\0';
|
||||
sact.msgbuf2[0] = '\0';
|
||||
|
||||
// キャンバスのクリア
|
||||
sf = sp->u.msg.canvas;
|
||||
memset(sf->pixel, 0, sf->bytes_per_line * sf->height);
|
||||
memset(sf->alpha, 0, sf->width * sf->height);
|
||||
|
||||
|
||||
// Clear the canvas
|
||||
SDL_FillRect(sp->u.msg.canvas, NULL, 0);
|
||||
|
||||
sp_updateme(sp);
|
||||
|
||||
if (sact.logging) {
|
||||
@@ -381,10 +375,29 @@ void smsg_clear(int wNum) {
|
||||
出力中の文字列があるかチェック
|
||||
@return: なし(1) , あり(0)
|
||||
*/
|
||||
int smsg_is_empty() {
|
||||
bool smsg_is_empty() {
|
||||
return (sact.msgbuf[0] == '\0');
|
||||
}
|
||||
|
||||
int smsg_peek(int nTopStringNum) {
|
||||
char *p = sact.msgbuf;
|
||||
int i;
|
||||
for (i = 0; *p; i++) {
|
||||
char *q = strchr(p, '\n');
|
||||
if (q)
|
||||
*q = '\0';
|
||||
svar_set(nTopStringNum + i, p);
|
||||
if (q) {
|
||||
*q = '\n';
|
||||
p = q + 2;
|
||||
} else {
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
メッセージキー入力待ち
|
||||
@param wNum1: スプライト番号1(アニメーションスプライト)
|
||||
@@ -433,38 +446,23 @@ int smsg_keywait(int wNum1, int wNum2, int msglen) {
|
||||
スプライト再描画のコールバック
|
||||
@param sp: 再描画するスプライト
|
||||
*/
|
||||
int smsg_update(sprite_t *sp) {
|
||||
int sx, sy, w, h, dx, dy;
|
||||
surface_t update;
|
||||
|
||||
// canvas が clean のときはなにもしない
|
||||
// -> 説明スプライトのように、SetShowされたときに対応できないからだめ
|
||||
//if (sact.msgbufempty) return OK;
|
||||
|
||||
update.width = sact.updaterect.w;
|
||||
update.height = sact.updaterect.h;
|
||||
|
||||
dx = sp->cur.x - sact.updaterect.x;
|
||||
dy = sp->cur.y - sact.updaterect.y;
|
||||
|
||||
w = sp->cursize.width;
|
||||
h = sp->cursize.height;
|
||||
|
||||
sx = 0; sy = 0;
|
||||
|
||||
if (!gr_clip(sp->u.msg.canvas, &sx, &sy, &w, &h, &update, &dx, &dy)) {
|
||||
return NG;
|
||||
void smsg_update(sprite_t *sp) {
|
||||
SDL_Rect sp_rect = {0, 0, sp->cursize.width, sp->cursize.height};
|
||||
int sx = 0;
|
||||
int sy = 0;
|
||||
int dx = sp->cur.x;
|
||||
int dy = sp->cur.y;
|
||||
int w = sp->cursize.width;
|
||||
int h = sp->cursize.height;
|
||||
if (!ags_clipCopyRect(&sp_rect, &sact.updaterect, &sx, &sy, &dx, &dy, &w, &h)) {
|
||||
return;
|
||||
}
|
||||
|
||||
dx += sact.updaterect.x;
|
||||
dy += sact.updaterect.y;
|
||||
|
||||
gre_BlendUseAMap(sf0, dx, dy, sf0, dx, dy, sp->u.msg.canvas, sx, sy, w, h, sp->u.msg.canvas, sx, sy, sp->blendrate);
|
||||
SDL_SetSurfaceBlendMode(sp->u.msg.canvas, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetSurfaceAlphaMod(sp->u.msg.canvas, sp->blendrate);
|
||||
SDL_BlitSurface(sp->u.msg.canvas, &(SDL_Rect){sx, sy, w, h}, main_surface, &(SDL_Rect){dx, dy, w, h});
|
||||
|
||||
SACT_DEBUG("do update no=%d, sx=%d, sy=%d, w=%d, h=%d, dx=%d, dy=%d",
|
||||
sp->no, sx, sy, w, h, dx, dy);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 改行を含む文字列バッファ中から、改行までの文字列の長さを取り出す
|
||||
|
||||
@@ -48,7 +48,7 @@ static int eventCB_PUT(sprite_t *sp, agsevent_t *e) {
|
||||
update++;
|
||||
}
|
||||
|
||||
sp->pressed = TRUE;
|
||||
sp->pressed = true;
|
||||
break;
|
||||
|
||||
case AGSEVENT_BUTTON_RELEASE:
|
||||
@@ -76,7 +76,7 @@ static int eventCB_PUT(sprite_t *sp, agsevent_t *e) {
|
||||
ssnd_play(sp->numsound2);
|
||||
}
|
||||
}
|
||||
sp->pressed = FALSE;
|
||||
sp->pressed = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -98,9 +98,7 @@ static void cb_remove(sprite_t *sp) {
|
||||
sp_new の時にスプライトの種類毎の初期化
|
||||
@param sp: 初期化するスプライト
|
||||
*/
|
||||
int sp_put_setup(sprite_t *sp) {
|
||||
void sp_put_setup(sprite_t *sp) {
|
||||
spev_add_eventlistener(sp, eventCB_PUT);
|
||||
sp->remove = cb_remove;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#include "list.h"
|
||||
#include "input.h"
|
||||
#include "sact.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "sprite.h"
|
||||
#include "sdl_core.h"
|
||||
#include "randMT.h"
|
||||
@@ -46,7 +44,7 @@
|
||||
@param wCount: 時間(1/100秒)
|
||||
@param cancel: キーキャンセルあり(=1)
|
||||
*/
|
||||
int sp_quake_sprite(int wType, int wAmplitudeX, int wAmplitudeY, int wCount, int cancel) {
|
||||
void sp_quake_sprite(int wType, int wAmplitudeX, int wAmplitudeY, int wCount, int cancel) {
|
||||
int edtime, curtime;
|
||||
int i = 0, key;
|
||||
SList *node;
|
||||
@@ -97,5 +95,4 @@ int sp_quake_sprite(int wType, int wAmplitudeX, int wAmplitudeY, int wCount, int
|
||||
sp_updateme(sp);
|
||||
}
|
||||
sp_update_clipped();
|
||||
return OK;
|
||||
}
|
||||
|
||||
+36
-40
@@ -26,6 +26,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include "portab.h"
|
||||
#include "nact.h"
|
||||
@@ -33,25 +34,20 @@
|
||||
#include "input.h"
|
||||
#include "sact.h"
|
||||
#include "sprite.h"
|
||||
#include "ngraph.h"
|
||||
#include "drawtext.h"
|
||||
|
||||
// 選択された要素(1~) キャンセルの場合は0、初期状態は -1
|
||||
static int selected_item;
|
||||
static int selected_item_cur;
|
||||
|
||||
// 選択肢を描画するsurface
|
||||
static surface_t *selcanvas;
|
||||
|
||||
// 前のカーソルの状態
|
||||
static boolean oldstate; // spriteの中か外か
|
||||
static bool oldstate; // spriteの中か外か
|
||||
static int oldindex; // 何番目の要素か(0~)
|
||||
|
||||
|
||||
static boolean sp_is_insprite2(sprite_t *sp, int x, int y, int margin);
|
||||
static bool sp_is_insprite2(sprite_t *sp, int x, int y, int margin);
|
||||
static void cb_select_move(agsevent_t *e);
|
||||
static void cb_select_release(agsevent_t *e);
|
||||
static int update_selwindow(sprite_t *sp);
|
||||
static void setup_selwindow();
|
||||
static void remove_selwindow();
|
||||
static int sel_main();
|
||||
@@ -63,13 +59,13 @@ static int sel_main();
|
||||
* 内側にマージンを含む sprite内領域チェック
|
||||
* マージン内はsprite内部とは判断しない
|
||||
*/
|
||||
static boolean sp_is_insprite2(sprite_t *sp, int x, int y, int margin) {
|
||||
static bool sp_is_insprite2(sprite_t *sp, int x, int y, int margin) {
|
||||
MyPoint p = {x, y};
|
||||
MyRectangle r = {
|
||||
sp->cur.x + margin,
|
||||
sp->cur.y + margin,
|
||||
sp->curcg->sf->width - 2 * margin,
|
||||
sp->curcg->sf->height - 2 * margin
|
||||
sp->curcg->sf->w - 2 * margin,
|
||||
sp->curcg->sf->h - 2 * margin
|
||||
};
|
||||
return SDL_PointInRect(&p, &r);
|
||||
}
|
||||
@@ -78,7 +74,7 @@ static boolean sp_is_insprite2(sprite_t *sp, int x, int y, int margin) {
|
||||
static void cb_select_move(agsevent_t *e) {
|
||||
int x = e->mousex, y = e->mousey;
|
||||
sprite_t *sp = sact.sp[sact.sel.spno];
|
||||
boolean newstate;
|
||||
bool newstate;
|
||||
int newindex;
|
||||
|
||||
// sprite内か?
|
||||
@@ -86,7 +82,7 @@ static void cb_select_move(agsevent_t *e) {
|
||||
newindex = (y - (sp->cur.y + sact.sel.frame_dot)) / (sact.sel.font_size + sact.sel.linespace);
|
||||
|
||||
if (newstate == oldstate) {
|
||||
if ((newstate == FALSE) || (newindex == oldindex)) {
|
||||
if (!newstate || newindex == oldindex) {
|
||||
// 前と状態が同じでかつ、新しい状態がspriteの外か、
|
||||
// indexが変わらない場合はなにもしない。
|
||||
return;
|
||||
@@ -116,7 +112,7 @@ static void cb_select_move(agsevent_t *e) {
|
||||
static void cb_select_release(agsevent_t *e) {
|
||||
int x = e->mousex, y = e->mousey;
|
||||
sprite_t *sp = sact.sp[sact.sel.spno];
|
||||
boolean st;
|
||||
bool st;
|
||||
int iy;
|
||||
|
||||
switch (e->code) {
|
||||
@@ -125,7 +121,7 @@ static void cb_select_release(agsevent_t *e) {
|
||||
iy = (y - (sp->cur.y + sact.sel.frame_dot)) / (sact.sel.font_size + sact.sel.linespace);
|
||||
|
||||
// カーソルが sprite の外の場合は無視
|
||||
if (st == FALSE) {
|
||||
if (!st) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -142,8 +138,19 @@ static void cb_select_release(agsevent_t *e) {
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_box(SDL_Surface *dst, int x, int y, int w, int h) {
|
||||
SDL_FillRect(dst, &(SDL_Rect){x, y, w, h}, SDL_MapRGB(dst->format, 0, 0, 0));
|
||||
SDL_Rect border_rects[4] = {
|
||||
{x, y, w, 1},
|
||||
{x, y + h - 1, w, 1},
|
||||
{x, y, 1, h},
|
||||
{x + w - 1, y, 1, h}
|
||||
};
|
||||
SDL_FillRects(dst, border_rects, 4, SDL_MapRGB(dst->format, 255, 255, 255));
|
||||
}
|
||||
|
||||
// 選択ウィンドを更新するときの callback
|
||||
static int update_selwindow(sprite_t *sp) {
|
||||
static void update_selwindow(sprite_t *sp) {
|
||||
int selno = selected_item_cur;
|
||||
int x0, y0;
|
||||
|
||||
@@ -154,20 +161,16 @@ static int update_selwindow(sprite_t *sp) {
|
||||
|
||||
// 選択されている要素
|
||||
if (selno && sact.sel.elem[selno] != NULL) {
|
||||
int w = selcanvas->width - 2 * sact.sel.frame_dot;
|
||||
int w = sact.sel.charcanvas->w - 2 * sact.sel.frame_dot;
|
||||
int h = sact.sel.font_size + sact.sel.linespace;
|
||||
int x = x0 + sact.sel.frame_dot;
|
||||
int y = y0 + sact.sel.frame_dot + (selno -1) * h;
|
||||
gr_fill(sf0, x, y, w, h, 0, 0, 0);
|
||||
gr_drawrect(sf0, x, y, w, h, 255, 255, 255);
|
||||
draw_box(main_surface, x, y, w, h);
|
||||
}
|
||||
|
||||
// 選択肢文字列
|
||||
gr_expandcolor_blend(sf0, x0, y0,
|
||||
sact.sel.charcanvas, 0, 0,
|
||||
selcanvas->width, selcanvas->height, 255, 255, 255);
|
||||
|
||||
return OK;
|
||||
SDL_BlitSurface(sact.sel.charcanvas, NULL, main_surface,
|
||||
&(SDL_Rect){x0, y0, sact.sel.charcanvas->w, sact.sel.charcanvas->h});
|
||||
}
|
||||
|
||||
// 選択ウィンドの準備
|
||||
@@ -175,11 +178,9 @@ static void setup_selwindow() {
|
||||
sprite_t *sp = sact.sp[sact.sel.spno];
|
||||
int i;
|
||||
|
||||
//選択ウィンド作業 surfaceの生成
|
||||
selcanvas = sf_dup(sp->cg1->sf);
|
||||
|
||||
// 選択肢文字用 canvas
|
||||
sact.sel.charcanvas = sf_create_pixel(selcanvas->width, selcanvas->height, 8);
|
||||
sact.sel.charcanvas = SDL_CreateRGBSurfaceWithFormat(0, sp->cg1->sf->w, sp->cg1->sf->h, 32, SDL_PIXELFORMAT_ARGB8888);
|
||||
SDL_SetSurfaceBlendMode(sact.sel.charcanvas, SDL_BLENDMODE_BLEND);
|
||||
|
||||
dt_setfont(sact.sel.font_type, sact.sel.font_size);
|
||||
|
||||
@@ -190,9 +191,9 @@ static void setup_selwindow() {
|
||||
// 文字の場所計算
|
||||
x = 0; // 行そろえは無し
|
||||
y = (i - 1) * (sact.sel.font_size + sact.sel.linespace);
|
||||
dt_drawtext(sact.sel.charcanvas,
|
||||
dt_drawtext_col(sact.sel.charcanvas,
|
||||
x + sact.sel.frame_dot, y + sact.sel.frame_dot,
|
||||
sact.sel.elem[i]);
|
||||
sact.sel.elem[i], 255, 255, 255);
|
||||
}
|
||||
|
||||
// デフォルトで選択される選択肢がある場合、そこへカーソルを移動
|
||||
@@ -202,7 +203,7 @@ static void setup_selwindow() {
|
||||
(sact.sel.font_size + sact.sel.linespace) * (sact.sel.movecursor - 1);
|
||||
ags_setCursorLocation(x, y, true, true);
|
||||
selected_item = (sact.sel.movecursor -1);
|
||||
oldstate = TRUE;
|
||||
oldstate = true;
|
||||
oldindex = selected_item -1;
|
||||
}
|
||||
|
||||
@@ -225,9 +226,8 @@ static void remove_selwindow() {
|
||||
sp_update_clipped();
|
||||
|
||||
// 作業用 surface の削除
|
||||
sf_free(selcanvas);
|
||||
selcanvas = NULL;
|
||||
sf_free(sact.sel.charcanvas);
|
||||
if (sact.sel.charcanvas)
|
||||
SDL_FreeSurface(sact.sel.charcanvas);
|
||||
sact.sel.charcanvas = NULL;
|
||||
}
|
||||
|
||||
@@ -264,12 +264,8 @@ void ssel_init() {
|
||||
|
||||
void ssel_reset(void) {
|
||||
ssel_clear();
|
||||
if (selcanvas) {
|
||||
sf_free(selcanvas);
|
||||
selcanvas = NULL;
|
||||
}
|
||||
if (sact.sel.charcanvas) {
|
||||
sf_free(sact.sel.charcanvas);
|
||||
SDL_FreeSurface(sact.sel.charcanvas);
|
||||
sact.sel.charcanvas = NULL;
|
||||
}
|
||||
}
|
||||
@@ -315,7 +311,7 @@ void ssel_add(int nString, int wI) {
|
||||
*/
|
||||
int ssel_select(int wNum, int wChoiceSize, int wMenuOutSpc, int wChoiceLineSpace, int wChoiceAutoMoveCursor, int nAlign) {
|
||||
int ret = 0;
|
||||
boolean saveflag;
|
||||
bool saveflag;
|
||||
|
||||
// check sprite number is sane
|
||||
if (wNum >= (SPRITEMAX-1) || wNum <= 0) return ret;
|
||||
@@ -335,7 +331,7 @@ int ssel_select(int wNum, int wChoiceSize, int wMenuOutSpc, int wChoiceLineSpace
|
||||
|
||||
// 古い sprite の表示フラグを保存
|
||||
saveflag = sact.sp[wNum]->show;
|
||||
sact.sp[wNum]->show = TRUE;
|
||||
sact.sp[wNum]->show = true;
|
||||
setup_selwindow();
|
||||
|
||||
ret = sel_main();
|
||||
|
||||
@@ -49,7 +49,7 @@ static int eventCB_switch(sprite_t *sp, agsevent_t *e) {
|
||||
update++;
|
||||
}
|
||||
|
||||
sp->pressed = TRUE;
|
||||
sp->pressed = true;
|
||||
break;
|
||||
|
||||
case AGSEVENT_BUTTON_RELEASE:
|
||||
@@ -71,7 +71,7 @@ static int eventCB_switch(sprite_t *sp, agsevent_t *e) {
|
||||
ssnd_play(sp->numsound2);
|
||||
}
|
||||
}
|
||||
sp->pressed = FALSE;
|
||||
sp->pressed = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -93,8 +93,7 @@ static void cb_remove(sprite_t *sp) {
|
||||
sp_new の時にスプライトの種類毎の初期化
|
||||
@param sp: 初期化するスプライト
|
||||
*/
|
||||
int sp_sw_setup(sprite_t *sp) {
|
||||
void sp_sw_setup(sprite_t *sp) {
|
||||
spev_add_eventlistener(sp, eventCB_switch);
|
||||
sp->remove = cb_remove;
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
#include "ags.h"
|
||||
#include "graphics.h"
|
||||
#include "sact.h"
|
||||
#include "surface.h"
|
||||
#include "ngraph.h"
|
||||
#include "sprite.h"
|
||||
|
||||
// スプライト再描画間の間に変更のあったスプライトの領域の和
|
||||
@@ -54,7 +52,7 @@ static void disjunction(void* region, void* data) {
|
||||
// 更新の必要なスプライトの領域の和をとってクリッピングする
|
||||
static void get_updatearea() {
|
||||
MyRectangle clip = {0, 0, 0, 0};
|
||||
MyRectangle rsf0 = {0, 0, sf0->width, sf0->height};
|
||||
MyRectangle screen = {0, 0, main_surface->w, main_surface->h};
|
||||
|
||||
slist_foreach(updatearea, disjunction, &clip);
|
||||
|
||||
@@ -62,7 +60,7 @@ static void get_updatearea() {
|
||||
updatearea = NULL;
|
||||
|
||||
// surface0との領域の積をとる
|
||||
SDL_IntersectRect(&rsf0, &clip, &sact.updaterect);
|
||||
SDL_IntersectRect(&screen, &clip, &sact.updaterect);
|
||||
|
||||
SACT_DEBUG("clipped area x=%d y=%d w=%d h=%d",
|
||||
sact.updaterect.x, sact.updaterect.y,
|
||||
@@ -90,7 +88,7 @@ static void do_update_each(void* data, void* userdata) {
|
||||
画面全体の更新
|
||||
@param syncscreen: surface0 に描画したものを Screen に反映させるかどうか
|
||||
*/
|
||||
int sp_update_all(boolean syncscreen) {
|
||||
void sp_update_all(bool syncscreen) {
|
||||
|
||||
// スプライト移動がある場合は移動開始
|
||||
if (sact.movelist) {
|
||||
@@ -104,8 +102,8 @@ int sp_update_all(boolean syncscreen) {
|
||||
// 画面全体を更新領域に
|
||||
sact.updaterect.x = 0;
|
||||
sact.updaterect.y = 0;
|
||||
sact.updaterect.w = sf0->width;
|
||||
sact.updaterect.h = sf0->height;
|
||||
sact.updaterect.w = main_surface->w;
|
||||
sact.updaterect.h = main_surface->h;
|
||||
|
||||
// updatelistに登録してあるスプライトを再描画
|
||||
// updatelistはスプライトの番号順に並んでいる
|
||||
@@ -121,20 +119,18 @@ int sp_update_all(boolean syncscreen) {
|
||||
// 移動中のすべてのスプライトが移動終了するまで待つ
|
||||
// こうしないと動きが同期しない
|
||||
spev_wait4moving_sp();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
画面の一部を更新
|
||||
updateme(_part)で登録した更新が必要なspriteの和の領域をupdate
|
||||
*/
|
||||
int sp_update_clipped() {
|
||||
void sp_update_clipped() {
|
||||
// 更新領域の確定
|
||||
get_updatearea();
|
||||
|
||||
if (SDL_RectEmpty(&sact.updaterect))
|
||||
return OK;
|
||||
return;
|
||||
|
||||
// 更新領域に入っているスプライトの再描画
|
||||
slist_foreach(sact.updatelist, do_update_each, NULL);
|
||||
@@ -146,19 +142,17 @@ int sp_update_clipped() {
|
||||
|
||||
// 更新領域を Window に転送
|
||||
ags_updateArea(sact.updaterect.x, sact.updaterect.y, sact.updaterect.w, sact.updaterect.h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
sprite全体の更新を登録
|
||||
@param sp: 更新するスプライト
|
||||
*/
|
||||
int sp_updateme(sprite_t *sp) {
|
||||
void sp_updateme(sprite_t *sp) {
|
||||
MyRectangle *r;
|
||||
|
||||
if (sp == NULL) return NG;
|
||||
if (sp->cursize.width == 0 || sp->cursize.height == 0) return NG;
|
||||
if (sp == NULL) return;
|
||||
if (sp->cursize.width == 0 || sp->cursize.height == 0) return;
|
||||
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r->x = sp->cur.x;
|
||||
@@ -170,8 +164,6 @@ int sp_updateme(sprite_t *sp) {
|
||||
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d",
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -182,11 +174,11 @@ int sp_updateme(sprite_t *sp) {
|
||||
@param w: 更新領域幅
|
||||
@param h: 更新領域高さ
|
||||
*/
|
||||
int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
void sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
MyRectangle *r;
|
||||
|
||||
if (sp == NULL) return NG;
|
||||
if (w == 0 || h == 0) return NG;
|
||||
if (sp == NULL) return;
|
||||
if (w == 0 || h == 0) return;
|
||||
|
||||
r = malloc(sizeof(MyRectangle));
|
||||
r->x = sp->cur.x + x;
|
||||
@@ -198,7 +190,5 @@ int sp_updateme_part(sprite_t *sp, int x, int y, int w, int h) {
|
||||
|
||||
SACT_DEBUG("x = %d, y = %d, spno = %d w=%d,h=%d",
|
||||
r->x, r->y, sp->no, r->w, r->h);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ struct _xm {
|
||||
|
||||
static struct _xm xmenu;
|
||||
|
||||
int spxm_clear(void) {
|
||||
void spxm_clear(void) {
|
||||
int i;
|
||||
|
||||
free(xmenu.title); xmenu.title = NULL;
|
||||
@@ -48,16 +48,14 @@ int spxm_clear(void) {
|
||||
free(xmenu.item[i]); xmenu.item[i] = NULL;
|
||||
xmenu.ret[i] = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int spxm_register(int reginum, int menuid) {
|
||||
if (reginum > SEL_ELEMENT_MAX) return NG;
|
||||
void spxm_register(int reginum, int menuid) {
|
||||
if (reginum > SEL_ELEMENT_MAX) return;
|
||||
|
||||
xmenu.ret[reginum] = menuid;
|
||||
xmenu.item[reginum] = strdup(sact.msgbuf);
|
||||
sact.msgbuf[0] = '\0';
|
||||
return OK;
|
||||
}
|
||||
|
||||
int spxm_getnum(int reginum) {
|
||||
@@ -65,19 +63,16 @@ int spxm_getnum(int reginum) {
|
||||
return xmenu.ret[reginum];
|
||||
}
|
||||
|
||||
int spxm_gettext(int reginum, int strno) {
|
||||
if (reginum > SEL_ELEMENT_MAX) return NG;
|
||||
void spxm_gettext(int reginum, int strno) {
|
||||
if (reginum > SEL_ELEMENT_MAX) return;
|
||||
svar_set(strno, xmenu.item[reginum]);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int spxm_titlereg(void) {
|
||||
void spxm_titlereg(void) {
|
||||
xmenu.title = strdup(sact.msgbuf);
|
||||
sact.msgbuf[0] = '\0';
|
||||
return OK;
|
||||
}
|
||||
|
||||
int spxm_titleget(int strno) {
|
||||
void spxm_titleget(int strno) {
|
||||
svar_set(strno, xmenu.title);
|
||||
return OK;
|
||||
}
|
||||
|
||||
+54
-54
@@ -49,7 +49,7 @@ static void GetAtArray(void) { /* 0 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i, j;
|
||||
|
||||
DEBUG_COMMAND("ShArray.GetAtArray %p,%d,%d,%p:", vAry, cnt, type, vResult);
|
||||
TRACE("ShArray.GetAtArray %p,%d,%d,%p:", vAry, cnt, type, vResult);
|
||||
|
||||
j = *vAry; vAry++;
|
||||
for (i = 1; i < cnt; i++) {
|
||||
@@ -93,7 +93,7 @@ static void AddAtArray(void) { /* 1 */
|
||||
int cnt = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.AddAtArray %p,%p,%d:", vAry1, vAry2, cnt);
|
||||
TRACE("ShArray.AddAtArray %p,%p,%d:", vAry1, vAry2, cnt);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
int result = (*vAry1) + (*vAry2);
|
||||
@@ -119,7 +119,7 @@ static void SubAtArray(void) { /* 2 */
|
||||
int cnt = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.SubAtArray %p,%p,%d:", vAry1, vAry2, cnt);
|
||||
TRACE("ShArray.SubAtArray %p,%p,%d:", vAry1, vAry2, cnt);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
int result = (*vAry1) - (*vAry2);
|
||||
@@ -145,7 +145,7 @@ static void MulAtArray(void) { /* 3 */
|
||||
int cnt = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.MulAtArray %p,%p,%d:", vAry1, vAry2, cnt);
|
||||
TRACE("ShArray.MulAtArray %p,%p,%d:", vAry1, vAry2, cnt);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
int result = (*vAry1) * (*vAry2);
|
||||
@@ -171,7 +171,7 @@ static void DivAtArray(void) { /* 4 */
|
||||
int cnt = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.DivAtArray: %d,%d,%d:", vAry1, vAry2, cnt);
|
||||
TRACE("ShArray.DivAtArray: %d,%d,%d:", vAry1, vAry2, cnt);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
if (*vAry2 == 0) {
|
||||
@@ -201,7 +201,7 @@ static void MinAtArray(void) { /* 5 */
|
||||
int cnt = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.MinAtArray: %d,%d,%d:", vAry1, vAry2, cnt);
|
||||
TRACE("ShArray.MinAtArray: %d,%d,%d:", vAry1, vAry2, cnt);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
if (*vAry1 < *vAry2) {
|
||||
@@ -224,7 +224,7 @@ static void MaxAtArray(void) { /* 6 */
|
||||
int cnt = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.MaxAtArray: %d,%d,%d:", vAry1, vAry2, cnt);
|
||||
TRACE("ShArray.MaxAtArray: %d,%d,%d:", vAry1, vAry2, cnt);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
if (*vAry1 > *vAry2) {
|
||||
@@ -247,7 +247,7 @@ static void AndNumArray(void) { /* 7 */
|
||||
int val = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.AndNumArray: %p,%d,%d:", vAry, cnt, val);
|
||||
TRACE("ShArray.AndNumArray: %p,%d,%d:", vAry, cnt, val);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
(*vAry) &= val;
|
||||
@@ -268,7 +268,7 @@ static void OrNumArray(void) { /* 8 */
|
||||
int val = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.OrNumArray: %p,%d,%d:", vAry, cnt, val);
|
||||
TRACE("ShArray.OrNumArray: %p,%d,%d:", vAry, cnt, val);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
(*vAry) |= val;
|
||||
@@ -289,7 +289,7 @@ static void XorNumArray(void) { /* 9 */
|
||||
int val = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.XorNumArray %p,%d,%d:", vAry, cnt, val);
|
||||
TRACE("ShArray.XorNumArray %p,%d,%d:", vAry, cnt, val);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
(*vAry) ^= val;
|
||||
@@ -313,7 +313,7 @@ static void SetEquArray(void) { /* 10 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.SetEquArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
TRACE("ShArray.SetEquArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*vResults = (*vAry == val) ? 1 : 0;
|
||||
@@ -337,7 +337,7 @@ static void SetNotArray(void) { /* 11 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.SetNotArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
TRACE("ShArray.SetNotArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*vResults = (*vAry != val) ? 1 : 0;
|
||||
@@ -360,7 +360,7 @@ static void SetLowArray(void) { /* 12 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.SetLowArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
TRACE("ShArray.SetLowArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
(*vResults) = ((*vAry < val) ? 1 : 0);
|
||||
@@ -383,7 +383,7 @@ static void SetHighArray(void) { /* 13 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.SetHighArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
TRACE("ShArray.SetHighArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
(*vResults) = ((*vAry > val) ? 1 : 0);
|
||||
@@ -410,7 +410,7 @@ static void SetRangeArray(void) { /* 14 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.SetRangeArray %p,%d,%d,%d,%p:", vAry, cnt, min, max, vResults);
|
||||
TRACE("ShArray.SetRangeArray %p,%d,%d,%d,%p:", vAry, cnt, min, max, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*vResults = ((*vAry > min) && (*vAry < max)) ? 1 : 0;
|
||||
@@ -437,7 +437,7 @@ static void SetAndEquArray(void) { /* 15 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.SetAndEquArray: %p,%d,%d,%d,%p:", vAry, mask, cnt, val, vResults);
|
||||
TRACE("ShArray.SetAndEquArray: %p,%d,%d,%d,%p:", vAry, mask, cnt, val, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*vResults = ((*vAry & mask) == val) ? 1 : 0;
|
||||
@@ -461,7 +461,7 @@ static void AndEquArray(void) { /* 16 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.AndEquArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
TRACE("ShArray.AndEquArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*vResults &= ((*vAry == val) ? 1 : 0);
|
||||
@@ -485,7 +485,7 @@ static void AndNotArray(void) { /* 17 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.AndNotArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
TRACE("ShArray.AndNotArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*vResults &= ((*vAry != val) ? 1 : 0);
|
||||
@@ -509,7 +509,7 @@ static void AndLowArray(void) { /* 18 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.AndLowArray: %d,%d,%d,%d:", vAry, cnt, min, vResults);
|
||||
TRACE("ShArray.AndLowArray: %d,%d,%d,%d:", vAry, cnt, min, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*vResults &= ((*vAry < min) ? 1 : 0);
|
||||
@@ -533,7 +533,7 @@ static void AndHighArray(void) { /* 19 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.AndHighArray: %p,%d,%d,%p:", vAry, cnt, max, vResults);
|
||||
TRACE("ShArray.AndHighArray: %p,%d,%d,%p:", vAry, cnt, max, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*vResults &= ((*vAry > max) ? 1 : 0);
|
||||
@@ -559,7 +559,7 @@ static void AndRangeArray(void) { /* 20 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.AndRangeArray %d,%d,%d,%d,%d:", vAry, cnt, min, max, vResults);
|
||||
TRACE("ShArray.AndRangeArray %d,%d,%d,%d,%d:", vAry, cnt, min, max, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
*vResults &= (((*vAry > min) && (*vAry < max)) ? 1 : 0);
|
||||
@@ -586,7 +586,7 @@ static void AndAndEquArray(void) { /* 21 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.AndAndEquArray: %d,%d,%d,%d,%d:", vAry, mask, cnt, val, vResults);
|
||||
TRACE("ShArray.AndAndEquArray: %d,%d,%d,%d,%d:", vAry, mask, cnt, val, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
(*vResults) &= (((*vAry & mask) == val) ? 1 : 0);
|
||||
@@ -600,7 +600,7 @@ static void OrEquArray(void) { /* 22 */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.OrEquArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
TRACE_UNIMPLEMENTED("ShArray.OrEquArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void OrNotArray(void) { /* 23 */
|
||||
@@ -618,7 +618,7 @@ static void OrNotArray(void) { /* 23 */
|
||||
int *vResults = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.OrNotArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
TRACE("ShArray.OrNotArray %p,%d,%d,%p:", vAry, cnt, val, vResults);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
// if (*vAry != val) *vResults = 1;
|
||||
@@ -633,7 +633,7 @@ static void OrLowArray(void) { /* 24 */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.OrLowArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
TRACE_UNIMPLEMENTED("ShArray.OrLowArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void OrHighArray(void) { /* 25 */
|
||||
@@ -642,7 +642,7 @@ static void OrHighArray(void) { /* 25 */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.OrHighArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
TRACE_UNIMPLEMENTED("ShArray.OrHighArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void OrRangeArray(void) { /* 26 */
|
||||
@@ -652,7 +652,7 @@ static void OrRangeArray(void) { /* 26 */
|
||||
int p4 = getCaliValue();
|
||||
int p5 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.OrRangeArray: %d,%d,%d,%d,%d:", p1, p2, p3, p4,p5);
|
||||
TRACE_UNIMPLEMENTED("ShArray.OrRangeArray: %d,%d,%d,%d,%d:", p1, p2, p3, p4,p5);
|
||||
}
|
||||
|
||||
static void OrAndEquArray(void) { /* 27 */
|
||||
@@ -662,7 +662,7 @@ static void OrAndEquArray(void) { /* 27 */
|
||||
int p4 = getCaliValue();
|
||||
int p5 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.OrAndEquArray: %d,%d,%d,%d,%d:", p1, p2, p3, p4,p5);
|
||||
TRACE_UNIMPLEMENTED("ShArray.OrAndEquArray: %d,%d,%d,%d,%d:", p1, p2, p3, p4,p5);
|
||||
}
|
||||
|
||||
static void EnumEquArray(void) { /* 28 */
|
||||
@@ -680,7 +680,7 @@ static void EnumEquArray(void) { /* 28 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.EnumEquArray %p,%d,%d,%p:", vAry, cnt, val, vResult);
|
||||
TRACE("ShArray.EnumEquArray %p,%d,%d,%p:", vAry, cnt, val, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
@@ -698,7 +698,7 @@ static void EnumEquArray2(void) { /* 29 */
|
||||
int p5 = getCaliValue();
|
||||
int p6 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.EnumEquArray2: %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
|
||||
TRACE_UNIMPLEMENTED("ShArray.EnumEquArray2: %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
|
||||
}
|
||||
|
||||
static void EnumEquNotArray2(void) { /* 30 */
|
||||
@@ -721,7 +721,7 @@ static void EnumEquNotArray2(void) { /* 30 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.EnumEquNotArray2 %p,%p,%d,%d,%d,%p:", vAry1, vAry2, cnt, val1, val2, vResult);
|
||||
TRACE("ShArray.EnumEquNotArray2 %p,%p,%d,%d,%d,%p:", vAry1, vAry2, cnt, val1, val2, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
@@ -748,7 +748,7 @@ static void EnumNotArray(void) { /* 31 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.EnumNotArray %p, %d, %d, %p:", vAry, cnt, val, vResult);
|
||||
TRACE("ShArray.EnumNotArray %p, %d, %d, %p:", vAry, cnt, val, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
@@ -768,7 +768,7 @@ static void EnumNotArray2(void) { /* 32 */
|
||||
int p5 = getCaliValue();
|
||||
int p6 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.EnumNotArray2: %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
|
||||
TRACE_UNIMPLEMENTED("ShArray.EnumNotArray2: %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
|
||||
}
|
||||
|
||||
static void EnumLowArray(void) { /* 33 */
|
||||
@@ -777,7 +777,7 @@ static void EnumLowArray(void) { /* 33 */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.EnumLowArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
TRACE_UNIMPLEMENTED("ShArray.EnumLowArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void EnumHighArray(void) { /* 34 */
|
||||
@@ -786,7 +786,7 @@ static void EnumHighArray(void) { /* 34 */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.EnumHighArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
TRACE_UNIMPLEMENTED("ShArray.EnumHighArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void EnumRangeArray(void) { /* 35 */
|
||||
@@ -806,7 +806,7 @@ static void EnumRangeArray(void) { /* 35 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.EnumRangeArray %d,%d,%d,%d,%d:", vAry, cnt, min, max, vResult);
|
||||
TRACE("ShArray.EnumRangeArray %d,%d,%d,%d,%d:", vAry, cnt, min, max, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
@@ -837,7 +837,7 @@ static void GrepEquArray(void) { /* 36 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.GrepEquArray %p,%d,%d,%p,%p:", vAry, cnt, val, vMatch, vResult);
|
||||
TRACE("ShArray.GrepEquArray %p,%d,%d,%p,%p:", vAry, cnt, val, vMatch, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
@@ -869,7 +869,7 @@ static void GrepNotArray(void) { /* 37 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.GrepNotArray %p,%d,%d,%p,%p:", vAry, cnt, val, vMatch, vResult);
|
||||
TRACE("ShArray.GrepNotArray %p,%d,%d,%p,%p:", vAry, cnt, val, vMatch, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
@@ -892,7 +892,7 @@ static void GrepEquArray2(void) { /* 38 */
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.GrepEquArray2: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
TRACE_UNIMPLEMENTED("ShArray.GrepEquArray2: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static void GrepNotArray2(void) { /* 39 */
|
||||
@@ -904,7 +904,7 @@ static void GrepNotArray2(void) { /* 39 */
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.GrepNotArray2: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
TRACE_UNIMPLEMENTED("ShArray.GrepNotArray2: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static void GrepEquNotArray2(void) { /* 40 */
|
||||
@@ -916,7 +916,7 @@ static void GrepEquNotArray2(void) { /* 40 */
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.GrepEquNotArray2: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
TRACE_UNIMPLEMENTED("ShArray.GrepEquNotArray2: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static void GrepLowArray(void) { /* 41 */
|
||||
@@ -937,7 +937,7 @@ static void GrepLowArray(void) { /* 41 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.GrepLowArray: %p,%d,%d,%p,%p:", vAry, cnt, min, vMatch, vResult);
|
||||
TRACE("ShArray.GrepLowArray: %p,%d,%d,%p,%p:", vAry, cnt, min, vMatch, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
@@ -969,7 +969,7 @@ static void GrepHighArray(void) { /* 42 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.GrepHighArray: %p,%d,%d,%p,%p:", vAry, cnt, max, vMatch, vResult);
|
||||
TRACE("ShArray.GrepHighArray: %p,%d,%d,%p,%p:", vAry, cnt, max, vMatch, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
@@ -1003,7 +1003,7 @@ static void GrepRangeArray(void) { /* 43 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.GrepRangeArray %p,%d,%d,%d,%p,%p:", vAry, cnt, max, min, vMatch, vResult);
|
||||
TRACE("ShArray.GrepRangeArray %p,%d,%d,%d,%p,%p:", vAry, cnt, max, min, vMatch, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
@@ -1040,7 +1040,7 @@ static void GrepLowOrderArray(void) { /* 44 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i, j, k = 0;
|
||||
|
||||
DEBUG_COMMAND("ShArray.GrepLowOrderArray %p,%d,%d,%d,%p,%p,%p:", vAry, cnt, min, max, v1, vLastMatch, vResult);
|
||||
TRACE("ShArray.GrepLowOrderArray %p,%d,%d,%d,%p,%p,%p:", vAry, cnt, min, max, v1, vLastMatch, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
@@ -1091,7 +1091,7 @@ static void GrepHighOrderArray(void) { /* 45 */
|
||||
int *vResult = getCaliVariable();
|
||||
int i, j, k = 0;
|
||||
|
||||
DEBUG_COMMAND("ShArray.GrepHighOrderArray %p,%d,%d,%d,%p,%p,%p:", vAry, cnt, min, max, v1, vLastMatch, vResult);
|
||||
TRACE("ShArray.GrepHighOrderArray %p,%d,%d,%d,%p,%p,%p:", vAry, cnt, min, max, v1, vLastMatch, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
@@ -1125,7 +1125,7 @@ static void ChangeEquArray(void) { /* 46 */
|
||||
int dst = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.ChangeEquArray: %d,%d,%d,%d:", vAry, cnt, src, dst);
|
||||
TRACE("ShArray.ChangeEquArray: %d,%d,%d,%d:", vAry, cnt, src, dst);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
if (*vAry == src) {
|
||||
@@ -1141,7 +1141,7 @@ static void ChangeNotArray(void) { /* 47 */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.ChangeNotArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
TRACE_UNIMPLEMENTED("ShArray.ChangeNotArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void ChangeLowArray(void) { /* 48 */
|
||||
@@ -1150,7 +1150,7 @@ static void ChangeLowArray(void) { /* 48 */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.ChangeLowArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
TRACE_UNIMPLEMENTED("ShArray.ChangeLowArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void ChangeHighArray(void) { /* 49 */
|
||||
@@ -1159,7 +1159,7 @@ static void ChangeHighArray(void) { /* 49 */
|
||||
int p3 = getCaliValue();
|
||||
int p4 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShArray.ChangeHighArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
TRACE_UNIMPLEMENTED("ShArray.ChangeHighArray: %d,%d,%d,%d:", p1, p2, p3, p4);
|
||||
}
|
||||
|
||||
static void ChangeRangeArray(void) { /* 50 */
|
||||
@@ -1179,7 +1179,7 @@ static void ChangeRangeArray(void) { /* 50 */
|
||||
int val = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShArray.ChangeRangeArray %p,%d,%d,%d,%d:", vAry, cnt, min, max, val);
|
||||
TRACE("ShArray.ChangeRangeArray %p,%d,%d,%d,%d:", vAry, cnt, min, max, val);
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
if ((*vAry > min) && (*vAry < max)) {
|
||||
@@ -1212,7 +1212,7 @@ static void CopyArrayToRect(void) { /* 51 */
|
||||
int dh = getCaliValue();
|
||||
int x, y;
|
||||
|
||||
DEBUG_COMMAND("ShArray.CopyArrayToRect %p,%d,%d,%d,%d,%p,%d,%d:", vSrc, sw, sh, sx, sy, vDst, dw, dh);
|
||||
TRACE("ShArray.CopyArrayToRect %p,%d,%d,%d,%d,%p,%d,%d:", vSrc, sw, sh, sx, sy, vDst, dw, dh);
|
||||
|
||||
vSrc += (sy * sw + sx);
|
||||
for (y = 0; y < dh; y++) {
|
||||
@@ -1246,7 +1246,7 @@ static void CopyRectToArray(void) { /* 52 */
|
||||
int dy = getCaliValue();
|
||||
int x, y;
|
||||
|
||||
DEBUG_COMMAND("ShArray.CopyRectToArray %p,%d,%d,%p,%d,%d,%d,%d:", vSrc, sw, sh, vDst, dw, dh, dx, dy);
|
||||
TRACE("ShArray.CopyRectToArray %p,%d,%d,%p,%d,%d,%d,%d:", vSrc, sw, sh, vDst, dw, dh, dx, dy);
|
||||
|
||||
vDst += (dy * dw + dx);
|
||||
for (y = 0; y < sh; y++) {
|
||||
@@ -1272,7 +1272,7 @@ static void ChangeSecretArray(void) { /* 53 */
|
||||
int *vResult = getCaliVariable();
|
||||
static uint16_t key[4] = { 0x7A7A, 0xADAD, 0xBCBC, 0xCECE }; /* key */
|
||||
|
||||
DEBUG_COMMAND("ShArray.ChangeSecretArray %p,%d,%d,%p:", vAry, cnt, type, vResult);
|
||||
TRACE("ShArray.ChangeSecretArray %p,%d,%d,%p:", vAry, cnt, type, vResult);
|
||||
|
||||
*vResult = 0;
|
||||
|
||||
|
||||
+68
-44
@@ -38,9 +38,7 @@
|
||||
#include "randMT.h"
|
||||
|
||||
static int numbase;
|
||||
static int64_t l_1000A0C8;
|
||||
static int64_t l_1000A0D0;
|
||||
static int64_t l_1000A0D8;
|
||||
static int64_t accumulator;
|
||||
|
||||
static int64_t mul64(int64_t a1, int64_t a2) {
|
||||
return a1 * a2;
|
||||
@@ -52,6 +50,10 @@ static int64_t div64(int64_t a1, int64_t a2) {
|
||||
return a1 / a2;
|
||||
}
|
||||
|
||||
static int64_t get32(int *var) {
|
||||
return var[0] + mul64(var[1], 0x10000);
|
||||
}
|
||||
|
||||
static void SetIntNumBase(void) { /* 0 */
|
||||
/*
|
||||
64 bit 演算のための倍数をセット
|
||||
@@ -62,7 +64,7 @@ static void SetIntNumBase(void) { /* 0 */
|
||||
|
||||
numbase = base;
|
||||
|
||||
DEBUG_COMMAND("ShCalc.SetIntNumBase %d:", base);
|
||||
TRACE("ShCalc.SetIntNumBase %d:", base);
|
||||
|
||||
}
|
||||
|
||||
@@ -74,15 +76,17 @@ static void SetIntNum16(void) { /* 1 */
|
||||
*/
|
||||
int *var = getCaliVariable();
|
||||
|
||||
l_1000A0D8 = mul64(*var, numbase);
|
||||
accumulator = mul64(*var, numbase);
|
||||
|
||||
DEBUG_COMMAND("ShCalc.SetIntNum16 %p:", var);
|
||||
TRACE("ShCalc.SetIntNum16 %p:", var);
|
||||
}
|
||||
|
||||
static void SetIntNum32(void) { /* 2 */
|
||||
int p1 = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
|
||||
accumulator = mul64(get32(var), numbase);
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.SetIntNum32: %d:", p1);
|
||||
TRACE("ShCalc.SetIntNum32: %p:", var);
|
||||
}
|
||||
|
||||
static void GetIntNum16(void) { /* 3 */
|
||||
@@ -94,21 +98,26 @@ static void GetIntNum16(void) { /* 3 */
|
||||
int *var = getCaliVariable();
|
||||
int64_t i;
|
||||
|
||||
i = div64(l_1000A0D8, numbase);
|
||||
i = div64(accumulator, numbase);
|
||||
|
||||
if (i > 65535) {
|
||||
i = l_1000A0C8 = 65535;
|
||||
i = 65535;
|
||||
}
|
||||
|
||||
*var = i;
|
||||
|
||||
DEBUG_COMMAND("ShCalc.GetIntNum16 %d:", var);
|
||||
TRACE("ShCalc.GetIntNum16 %d:", var);
|
||||
}
|
||||
|
||||
static void GetIntNum32(void) { /* 4 */
|
||||
int p1 = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
int64_t i = div64(accumulator, numbase);
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.GetIntNum32: %d:", p1);
|
||||
var[0] = i & 0xFFFF;
|
||||
i >>= 16;
|
||||
var[1] = i > 0xFFFF ? 0xFFFF : i;
|
||||
|
||||
TRACE("ShCalc.GetIntNum32: %p:", var);
|
||||
}
|
||||
|
||||
static void AddIntNum16(void) { /* 5 */
|
||||
@@ -119,27 +128,31 @@ static void AddIntNum16(void) { /* 5 */
|
||||
*/
|
||||
int *var = getCaliVariable();
|
||||
|
||||
l_1000A0D8 += mul64(*var, numbase);
|
||||
accumulator += mul64(*var, numbase);
|
||||
|
||||
DEBUG_COMMAND("ShCalc.AddIntNum16 %p:", var);
|
||||
TRACE("ShCalc.AddIntNum16 %p:", var);
|
||||
}
|
||||
|
||||
static void AddIntNum32(void) { /* 6 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.AddIntNum32: %d:", p1);
|
||||
int *var = getCaliVariable();
|
||||
|
||||
accumulator += mul64(get32(var), numbase);
|
||||
|
||||
TRACE("ShCalc.AddIntNum32: %p:", var);
|
||||
}
|
||||
|
||||
static void SubIntNum16(void) { /* 7 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.SubIntNum16: %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("ShCalc.SubIntNum16: %d:", p1);
|
||||
}
|
||||
|
||||
static void SubIntNum32(void) { /* 8 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.SubIntNum32: %d:", p1);
|
||||
int *var = getCaliVariable();
|
||||
|
||||
accumulator -= mul64(get32(var), numbase);
|
||||
|
||||
TRACE("ShCalc.SubIntNum32: %p:", var);
|
||||
}
|
||||
|
||||
static void MulIntNum16(void) { /* 9 */
|
||||
@@ -150,15 +163,15 @@ static void MulIntNum16(void) { /* 9 */
|
||||
*/
|
||||
int *var = getCaliVariable();
|
||||
|
||||
l_1000A0D8 *= mul64(*var, numbase);
|
||||
accumulator *= mul64(*var, numbase);
|
||||
|
||||
DEBUG_COMMAND("ShCalc.MulIntNum16: %p:", var);
|
||||
TRACE("ShCalc.MulIntNum16: %p:", var);
|
||||
}
|
||||
|
||||
static void MulIntNum32(void) { /* 10 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.MulIntNum32: %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("ShCalc.MulIntNum32: %d:", p1);
|
||||
}
|
||||
|
||||
static void DivIntNum16(void) { /* 11 */
|
||||
@@ -170,18 +183,16 @@ static void DivIntNum16(void) { /* 11 */
|
||||
int *var = getCaliVariable();
|
||||
int64_t i;
|
||||
|
||||
l_1000A0C8 = *var;
|
||||
i = mul64(*var, numbase);
|
||||
accumulator = div64(accumulator, i);
|
||||
|
||||
i = mul64(l_1000A0C8, numbase);
|
||||
l_1000A0D8 = div64(l_1000A0D8, i);
|
||||
|
||||
DEBUG_COMMAND("ShCalc.DivIntNum16 %p:", var);
|
||||
TRACE("ShCalc.DivIntNum16 %p:", var);
|
||||
}
|
||||
|
||||
static void DivIntNum32(void) { /* 12 */
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.DivIntNum32: %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("ShCalc.DivIntNum32: %d:", p1);
|
||||
}
|
||||
|
||||
static void CmpIntNum16(void) { /* 13 */
|
||||
@@ -189,15 +200,28 @@ static void CmpIntNum16(void) { /* 13 */
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.CmpIntNum16: %d,%d,%d:", p1, p2, p3);
|
||||
TRACE_UNIMPLEMENTED("ShCalc.CmpIntNum16: %d,%d,%d:", p1, p2, p3);
|
||||
}
|
||||
|
||||
static void CmpIntNum32(void) { /* 14 */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
int *var = getCaliVariable();
|
||||
int op = getCaliValue();
|
||||
int *result = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.CmpIntNum32: %d,%d,%d:", p1, p2, p3);
|
||||
int64_t val = mul64(get32(var), numbase);
|
||||
|
||||
switch (op) {
|
||||
case 1: *result = val == accumulator; break;
|
||||
case 2: *result = val > accumulator; break;
|
||||
case 3: *result = val < accumulator; break;
|
||||
case 4: *result = val >= accumulator; break;
|
||||
case 5: *result = val <= accumulator; break;
|
||||
default:
|
||||
WARNING("ShCalc.CmpIntNum32: unknown operator %d", op);
|
||||
break;
|
||||
}
|
||||
|
||||
TRACE("ShCalc.CmpIntNum32: %p,%d,%p:", var, op, result);
|
||||
}
|
||||
|
||||
static void GetLengthNum16(void) { /* 15 */
|
||||
@@ -221,14 +245,14 @@ static void GetLengthNum16(void) { /* 15 */
|
||||
*vResult = 1;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShCalc.GetLengthNum16 %p,%p:", var, vResult);
|
||||
TRACE("ShCalc.GetLengthNum16 %p,%p:", var, vResult);
|
||||
}
|
||||
|
||||
static void GetLengthNum32(void) { /* 16 */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShCalc.GetLengthNum32: %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("ShCalc.GetLengthNum32: %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void NumToRate(void) { /* 17 */
|
||||
@@ -259,7 +283,7 @@ static void NumToRate(void) { /* 17 */
|
||||
|
||||
*vResult = i;
|
||||
|
||||
DEBUG_COMMAND("ShCalc.NumToRate %d,%d,%d,%d,%p:", p1, p2, p3, flag, vResult);
|
||||
TRACE("ShCalc.NumToRate %d,%d,%d,%d,%p:", p1, p2, p3, flag, vResult);
|
||||
|
||||
}
|
||||
|
||||
@@ -291,7 +315,7 @@ static void NumToRateNum(void) { /* 18 */
|
||||
|
||||
*vResult = i;
|
||||
|
||||
DEBUG_COMMAND("ShCalc.NumToRateNum %d,%d,%d,%d,%p:", p1, p2, p3, flag, vResult);
|
||||
TRACE("ShCalc.NumToRateNum %d,%d,%d,%d,%p:", p1, p2, p3, flag, vResult);
|
||||
}
|
||||
|
||||
static void SetRandomSeed() {
|
||||
@@ -304,7 +328,7 @@ static void SetRandomSeed() {
|
||||
|
||||
sgenrand(seed);
|
||||
|
||||
DEBUG_COMMAND("ShCalc.SetRandomSeed %d:", seed);
|
||||
TRACE("ShCalc.SetRandomSeed %d:", seed);
|
||||
}
|
||||
|
||||
static void GetRandomNumA() {
|
||||
@@ -317,7 +341,7 @@ static void GetRandomNumA() {
|
||||
*var = (int)(genrand() * num) + 1;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShCalc.GetRandomNumA %d,%p:", num, var);
|
||||
TRACE("ShCalc.GetRandomNumA %d,%p:", num, var);
|
||||
}
|
||||
|
||||
static void NumToBit() {
|
||||
@@ -339,7 +363,7 @@ static void NumToBit() {
|
||||
*var = 0;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShCalc.NumToBit %d,%p:", beki, var);
|
||||
TRACE("ShCalc.NumToBit %d,%p:", beki, var);
|
||||
}
|
||||
|
||||
static void BitToNum() {
|
||||
@@ -358,7 +382,7 @@ static void BitToNum() {
|
||||
int *var = getCaliVariable();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShCalc.BitToNum %d,%p:", val, var);
|
||||
TRACE("ShCalc.BitToNum %d,%p:", val, var);
|
||||
|
||||
if (val == 0) {
|
||||
*var = 0;
|
||||
|
||||
+35
-107
@@ -41,8 +41,6 @@
|
||||
|
||||
#define SLOT 40
|
||||
|
||||
static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, int r, int g, int b);
|
||||
|
||||
static MyRectangle maprect; /* アニメーション表示領域 */
|
||||
static MyRectangle mapback; /* 背景セーブ領域 */
|
||||
static int mapback_p5; /* 背景転送先 X */
|
||||
@@ -89,6 +87,14 @@ static struct _s2 s2[SLOT];
|
||||
|
||||
static int* add_p5[SLOT]; /* どこまでアニメーションのコマが進んだか */
|
||||
|
||||
static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, int r, int g, int b) {
|
||||
SDL_Surface *sf = nact->ags.dib->sdl_surface;
|
||||
SDL_SetColorKey(sf, SDL_TRUE, SDL_MapRGB(sf->format, r, g, b));
|
||||
SDL_Rect src_rect = { sx, sy, width, height };
|
||||
SDL_Rect dst_rect = { dx, dy, width, height };
|
||||
SDL_BlitSurface(sf, &src_rect, sf, &dst_rect);
|
||||
SDL_SetColorKey(sf, SDL_FALSE, 0);
|
||||
}
|
||||
|
||||
static void Init() {
|
||||
/*
|
||||
@@ -96,13 +102,13 @@ static void Init() {
|
||||
*/
|
||||
int p1 = getCaliValue(); /* ISurface */
|
||||
|
||||
DEBUG_COMMAND("ShGraph.Init %d:", p1);
|
||||
TRACE("ShGraph.Init %d:", p1);
|
||||
}
|
||||
|
||||
static void GetSurfaceData() {
|
||||
int p1 = getCaliValue(); /* ISurface */
|
||||
|
||||
DEBUG_COMMAND_YET("ShGraph.GetSurfaceData %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("ShGraph.GetSurfaceData %d:", p1);
|
||||
}
|
||||
|
||||
static void ChangeEquColor() {
|
||||
@@ -114,7 +120,7 @@ static void ChangeEquColor() {
|
||||
int *p6 = getCaliVariable();
|
||||
int p7 = getCaliValue(); /* ISurface */
|
||||
|
||||
DEBUG_COMMAND_YET("ShGraph.ChangeEquColor %d,%d,%d,%d,%p,%p,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
TRACE_UNIMPLEMENTED("ShGraph.ChangeEquColor %d,%d,%d,%d,%p,%p,%d:", p1, p2, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static void ChangeNotColor() {
|
||||
@@ -135,53 +141,29 @@ static void ChangeNotColor() {
|
||||
int *src = getCaliVariable(); /* r, g, b */
|
||||
int *dst = getCaliVariable(); /* r, g, b */
|
||||
int p7 = getCaliValue(); /* ISurface */
|
||||
agsurface_t *dib;
|
||||
surface_t *dib;
|
||||
int x, y;
|
||||
uint8_t *dp;
|
||||
|
||||
DEBUG_COMMAND("ShGraph.ChangeNotColor %d,%d,%d,%d,%p,%p,%d:", x0, y0, width, height, src, dst, p7);
|
||||
TRACE("ShGraph.ChangeNotColor %d,%d,%d,%d,%p,%p,%d:", x0, y0, width, height, src, dst, p7);
|
||||
|
||||
ags_check_param(&x0, &y0, &width, &height);
|
||||
|
||||
dib = nact->ags.dib;
|
||||
dp = GETOFFSET_PIXEL(dib, x0, y0);
|
||||
|
||||
switch(dib->depth) {
|
||||
case 16:
|
||||
{
|
||||
uint16_t pic16s = PIX16(*src, *(src+1), *(src+2));
|
||||
uint16_t pic16d = PIX16(*dst, *(dst+1), *(dst+2));
|
||||
uint16_t *yl;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yl = (uint16_t *)(dp + y * dib->bytes_per_line);
|
||||
for (x = 0; x < width; x++) {
|
||||
if (*yl != pic16s) {
|
||||
*yl = pic16d;
|
||||
}
|
||||
yl++;
|
||||
uint32_t pic24s = PIX24(*src, *(src+1), *(src+2));
|
||||
uint32_t pic24d = PIX24(*dst, *(dst+1), *(dst+2));
|
||||
uint32_t *yl;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yl = (uint32_t *)(dp + y * dib->sdl_surface->pitch);
|
||||
for (x = 0; x < width; x++) {
|
||||
if (*yl != pic24s) {
|
||||
*yl = pic24d;
|
||||
}
|
||||
yl++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
uint32_t pic24s = PIX24(*src, *(src+1), *(src+2));
|
||||
uint32_t pic24d = PIX24(*dst, *(dst+1), *(dst+2));
|
||||
uint32_t *yl;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yl = (uint32_t *)(dp + y * dib->bytes_per_line);
|
||||
for (x = 0; x < width; x++) {
|
||||
if (*yl != pic24s) {
|
||||
*yl = pic24d;
|
||||
}
|
||||
yl++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// The CX command after ChangeNotColor (in FIGHT.ADV) must use a precise
|
||||
// calculation.
|
||||
@@ -222,7 +204,7 @@ static void ResetAnimeData() {
|
||||
*/
|
||||
int no = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND("ShGraph.ResetAnimeData %d:", no);
|
||||
TRACE("ShGraph.ResetAnimeData %d:", no);
|
||||
|
||||
if (no > 0 && no <= SLOT) {
|
||||
memset(&src[no-1], 0, sizeof(struct animsrc));
|
||||
@@ -262,7 +244,7 @@ static void SetAnimeSrc() {
|
||||
int *pal = getCaliVariable();
|
||||
int r, g, b;
|
||||
|
||||
DEBUG_COMMAND("ShGraph.SetAnimeSrc %d,%d,%d,%d,%d,%d,%d,%p:", no, x0, y0, w, h, uw, uh, pal);
|
||||
TRACE("ShGraph.SetAnimeSrc %d,%d,%d,%d,%d,%d,%d,%p:", no, x0, y0, w, h, uw, uh, pal);
|
||||
|
||||
if (no <= 0 || no > SLOT) return;
|
||||
|
||||
@@ -302,7 +284,7 @@ static void SetAnimeDst() {
|
||||
int p5 = getCaliValue();
|
||||
int p6 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND("ShGraph.SetAnimeDst %d,%p,%p,%d,%d,%d,%d:", no, p1, p2, p3, p4, p5, p6);
|
||||
TRACE("ShGraph.SetAnimeDst %d,%p,%p,%d,%d,%d,%d:", no, p1, p2, p3, p4, p5, p6);
|
||||
|
||||
if (no <= 0 || no > SLOT) return;
|
||||
|
||||
@@ -336,7 +318,7 @@ static void AddAnimeData() {
|
||||
int p6 = getCaliValue();
|
||||
int i;
|
||||
|
||||
DEBUG_COMMAND("ShGraph.AddAnimeData %d,%d,%d,%d,%p,%d:", no, p2, p3, p4, p5, p6);
|
||||
TRACE("ShGraph.AddAnimeData %d,%d,%d,%d,%p,%d:", no, p2, p3, p4, p5, p6);
|
||||
|
||||
if (no <= 0 || no > SLOT) return;
|
||||
|
||||
@@ -370,7 +352,7 @@ static void AddAnimeRemain() {
|
||||
int no = getCaliValue();
|
||||
int i, _max = 0;
|
||||
|
||||
DEBUG_COMMAND("ShGraph.AddAnimeRemain %d:", no);
|
||||
TRACE("ShGraph.AddAnimeRemain %d:", no);
|
||||
|
||||
if (no <= 0 || no > SLOT) return;
|
||||
|
||||
@@ -401,7 +383,7 @@ static void SetAnimeRect() {
|
||||
int w = getCaliValue();
|
||||
int h = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND("ShGraph.SetAnimeRect %d,%d,%d,%d:", x, y, w, h);
|
||||
TRACE("ShGraph.SetAnimeRect %d,%d,%d,%d:", x, y, w, h);
|
||||
|
||||
maprect.x = x;
|
||||
maprect.y = y;
|
||||
@@ -427,7 +409,7 @@ static void SetAnimeBack() {
|
||||
int p5 = getCaliValue();
|
||||
int p6 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND("ShGraph.SetAnimeBack %d,%d,%d,%d,%d,%d:", sx, sy, w, h, p5, p6);
|
||||
TRACE("ShGraph.SetAnimeBack %d,%d,%d,%d,%d,%d:", sx, sy, w, h, p5, p6);
|
||||
|
||||
mapback.x = sx;
|
||||
mapback.y = sy;
|
||||
@@ -452,10 +434,10 @@ static void PlayAnimeData() {
|
||||
int p6 = getCaliValue(); /* IWinMsg */
|
||||
int interval, loop;
|
||||
int i;
|
||||
boolean is_backcopied;
|
||||
agsurface_t *dib;
|
||||
bool is_backcopied;
|
||||
surface_t *dib;
|
||||
|
||||
DEBUG_COMMAND("ShGraph.PlayAnimeData %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
|
||||
TRACE("ShGraph.PlayAnimeData %d,%d,%d,%d,%d,%d:", p1, p2, p3, p4, p5, p6);
|
||||
|
||||
interval = p2 * 10;
|
||||
|
||||
@@ -470,7 +452,7 @@ static void PlayAnimeData() {
|
||||
|
||||
for (loop = 0; loop < p1; loop++) {
|
||||
int cnt = sdl_getTicks();
|
||||
is_backcopied = FALSE;
|
||||
is_backcopied = false;
|
||||
|
||||
for (i = 0; i < SLOT; i++) {
|
||||
int srcno = s1[i].add_p2;
|
||||
@@ -489,7 +471,7 @@ static void PlayAnimeData() {
|
||||
int sx, sy, dx, dy;
|
||||
|
||||
if (!is_backcopied) {
|
||||
is_backcopied = TRUE;
|
||||
is_backcopied = true;
|
||||
ags_copyArea(mapback.x, mapback.y, mapback.w, mapback.h,
|
||||
mapback_p5, mapback_p6);
|
||||
}
|
||||
@@ -553,60 +535,6 @@ static void PlayAnimeData() {
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_sprite(int sx, int sy, int width, int height, int dx, int dy, int r, int g, int b) {
|
||||
int x, y;
|
||||
uint8_t *sp, *dp;
|
||||
agsurface_t *dib;
|
||||
|
||||
if (dx < 0 || dy < 0) return;
|
||||
|
||||
ags_check_param(&sx, &sy, &width, &height);
|
||||
ags_check_param(&dx, &dy, &width, &height);
|
||||
|
||||
dib = nact->ags.dib;
|
||||
|
||||
sp = GETOFFSET_PIXEL(dib, sx, sy);
|
||||
dp = GETOFFSET_PIXEL(dib, dx, dy);
|
||||
|
||||
switch(dib->depth) {
|
||||
case 16:
|
||||
{
|
||||
uint16_t pic16 = PIX16(r, g, b);
|
||||
uint16_t *yls, *yld;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (uint16_t *)(sp + y * dib->bytes_per_line);
|
||||
yld = (uint16_t *)(dp + y * dib->bytes_per_line);
|
||||
for (x = 0; x < width; x++) {
|
||||
if (*yls != pic16) {
|
||||
*yld = *yls;
|
||||
}
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 24:
|
||||
case 32:
|
||||
{
|
||||
uint32_t pic24 = PIX24(r, g, b);
|
||||
uint32_t *yls, *yld;
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
yls = (uint32_t *)(sp + y * dib->bytes_per_line);
|
||||
yld = (uint32_t *)(dp + y * dib->bytes_per_line);
|
||||
for (x = 0; x < width; x++) {
|
||||
if (*yls != pic24) {
|
||||
*yld = *yls;
|
||||
}
|
||||
yls++; yld++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"AddAnimeData", AddAnimeData},
|
||||
{"AddAnimeRemain", AddAnimeRemain},
|
||||
|
||||
+10
-11
@@ -36,7 +36,6 @@
|
||||
#include "xsystem35.h"
|
||||
#include "modules.h"
|
||||
#include "sdl_core.h"
|
||||
#include "sdl_private.h"
|
||||
#include "input.h"
|
||||
#include "menu.h"
|
||||
|
||||
@@ -55,12 +54,12 @@ static void OutputMessageBox(void) { /* 0 */
|
||||
char *title_utf8 = toUTF8(svar_get(title));
|
||||
char *msg_utf8 = toUTF8(svar_get(msg));
|
||||
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, title_utf8, msg_utf8, sdl_window);
|
||||
sdl_showMessageBox(MESSAGEBOX_INFO, title_utf8, msg_utf8);
|
||||
|
||||
free(title_utf8);
|
||||
free(msg_utf8);
|
||||
|
||||
DEBUG_COMMAND("ShPort.OutputMessageBox: %d,%d,%d,%d,%p,%d:", p1, p2, title, msg, res, ISys3xSystem);
|
||||
TRACE("ShPort.OutputMessageBox: %d,%d,%d,%d,%p,%d:", p1, p2, title, msg, res, ISys3xSystem);
|
||||
}
|
||||
|
||||
static void InputListNum(void) { /* 1 */
|
||||
@@ -88,7 +87,7 @@ static void InputListNum(void) { /* 1 */
|
||||
}
|
||||
|
||||
free(ni_param.title);
|
||||
DEBUG_COMMAND("ShPort.InputListNum: %d,%d,%p,%d,%d,%p,%d:", flags, title, val, minval, maxval, res, ISys3xSystem);
|
||||
TRACE("ShPort.InputListNum: %d,%d,%p,%d,%d,%p,%d:", flags, title, val, minval, maxval, res, ISys3xSystem);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +98,7 @@ static void InputListNum(void) { /* 1 */
|
||||
static void Init(void) {
|
||||
int p1 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShPort.Init: %d:", p1);
|
||||
TRACE_UNIMPLEMENTED("ShPort.Init: %d:", p1);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +120,7 @@ static void InitKeyStatus(void) {
|
||||
memset(keymap[no -1], 0, 256);
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShPort.InitKeyStatus: %d:", no);
|
||||
TRACE("ShPort.InitKeyStatus: %d:", no);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,7 +142,7 @@ static void SetKeyStatus(void) {
|
||||
|
||||
keymap[no -1][key] = func;
|
||||
|
||||
DEBUG_COMMAND("ShPort.SetKeyStatus: %d,%d,%d:", no, key, func);
|
||||
TRACE("ShPort.SetKeyStatus: %d,%d,%d:", no, key, func);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +166,7 @@ static void GetKeyStatus(void) {
|
||||
*var |= (keymap[no -1][i] * RawKeyInfo[i]);
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShPort.GetKeyStatus: %d,%p:", no, var);
|
||||
TRACE("ShPort.GetKeyStatus: %d,%p:", no, var);
|
||||
}
|
||||
|
||||
static void InputListString(void) {
|
||||
@@ -179,7 +178,7 @@ static void InputListString(void) {
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShPort.InputListString: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p3, p4, p5, p6, p7);
|
||||
TRACE_UNIMPLEMENTED("ShPort.InputListString: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static void InputOpenFile(void) {
|
||||
@@ -191,7 +190,7 @@ static void InputOpenFile(void) {
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShPort.InputOpenFile: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p3, p4, p5, p6, p7);
|
||||
TRACE_UNIMPLEMENTED("ShPort.InputOpenFile: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static void InputSaveFile(void) {
|
||||
@@ -203,7 +202,7 @@ static void InputSaveFile(void) {
|
||||
int p6 = getCaliValue();
|
||||
int p7 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShPort.InputSaveFile: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p3, p4, p5, p6, p7);
|
||||
TRACE_UNIMPLEMENTED("ShPort.InputSaveFile: %d,%d,%d,%d,%d,%d,%d:", p1, p2, p3, p3, p4, p5, p6, p7);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
+16
-16
@@ -54,7 +54,7 @@ static void Init() {
|
||||
*/
|
||||
int p1 = getCaliValue(); /* ISys3x */
|
||||
|
||||
DEBUG_COMMAND("ShSound.Init %d:", p1);
|
||||
TRACE("ShSound.Init %d:", p1);
|
||||
}
|
||||
|
||||
static void wavLoad() {
|
||||
@@ -67,7 +67,7 @@ static void wavLoad() {
|
||||
int slot = getCaliValue();
|
||||
int no = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavLoad %d,%d:", slot, no);
|
||||
TRACE("ShSound.wavLoad %d,%d:", slot, no);
|
||||
|
||||
mus_wav_load(slot, no);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ static void wavUnload() {
|
||||
|
||||
mus_wav_unload(slot);
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavUnload %d:",slot);
|
||||
TRACE("ShSound.wavUnload %d:",slot);
|
||||
}
|
||||
|
||||
static void wavUnloadRange() {
|
||||
@@ -100,7 +100,7 @@ static void wavUnloadRange() {
|
||||
mus_wav_unload(i);
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavUnloadRange %d,%d:", slot, range);
|
||||
TRACE("ShSound.wavUnloadRange %d,%d:", slot, range);
|
||||
}
|
||||
|
||||
static void wavUnloadAll() {
|
||||
@@ -113,7 +113,7 @@ static void wavUnloadAll() {
|
||||
mus_wav_unload(i);
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavUnloadAll:");
|
||||
TRACE("ShSound.wavUnloadAll:");
|
||||
}
|
||||
|
||||
static void wavLoadMemory() {
|
||||
@@ -142,7 +142,7 @@ static void wavLoadMemory() {
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavLoadMemory %d:", no);
|
||||
TRACE("ShSound.wavLoadMemory %d:", no);
|
||||
}
|
||||
|
||||
static void wavSendMemory() {
|
||||
@@ -186,7 +186,7 @@ static void wavSendMemory() {
|
||||
free_memory_wav();
|
||||
free(wav_buf);
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavSendMemory %d:", slot);
|
||||
TRACE("ShSound.wavSendMemory %d:", slot);
|
||||
}
|
||||
|
||||
static void wavFadeVolumeMemory() {
|
||||
@@ -220,7 +220,7 @@ static void wavFadeVolumeMemory() {
|
||||
// 残りは無音
|
||||
memset(buf, 0, memwav.buf + memwav.len - (uint8_t*)buf);
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavFadeVolumeMemory %d,%d:", start, range);
|
||||
TRACE("ShSound.wavFadeVolumeMemory %d,%d:", start, range);
|
||||
}
|
||||
|
||||
static void wavReversePanMemory() {
|
||||
@@ -240,7 +240,7 @@ static void wavReversePanMemory() {
|
||||
buf += 2;
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavReversePanMemory:");
|
||||
TRACE("ShSound.wavReversePanMemory:");
|
||||
}
|
||||
|
||||
static void wavPlay() {
|
||||
@@ -255,7 +255,7 @@ static void wavPlay() {
|
||||
|
||||
mus_wav_play(slot, loop == 0 ? 1 : -1);
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavPlay %d, %d:", slot, loop);
|
||||
TRACE("ShSound.wavPlay %d, %d:", slot, loop);
|
||||
}
|
||||
|
||||
static void wavPlayRing() {
|
||||
@@ -273,7 +273,7 @@ static void wavPlayRing() {
|
||||
mus_wav_play(start + (*cur % cnt), 1);
|
||||
*cur = (*cur + 1) % cnt;
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavPlayRing %d,%d,%d:", start, cnt, *cur);
|
||||
TRACE("ShSound.wavPlayRing %d,%d,%d:", start, cnt, *cur);
|
||||
}
|
||||
|
||||
static void wavStop() {
|
||||
@@ -284,7 +284,7 @@ static void wavStop() {
|
||||
*/
|
||||
int slot = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavStop %d:", slot);
|
||||
TRACE("ShSound.wavStop %d:", slot);
|
||||
|
||||
mus_wav_stop(slot);
|
||||
}
|
||||
@@ -299,7 +299,7 @@ static void wavStopAll() {
|
||||
mus_wav_stop(i);
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavStopAll:");
|
||||
TRACE("ShSound.wavStopAll:");
|
||||
}
|
||||
|
||||
static void wavPause() {
|
||||
@@ -310,7 +310,7 @@ static void wavPause() {
|
||||
*/
|
||||
int slot = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShSound.wavPause %d:", slot);
|
||||
TRACE_UNIMPLEMENTED("ShSound.wavPause %d:", slot);
|
||||
}
|
||||
|
||||
static void wavIsPlay() {
|
||||
@@ -325,7 +325,7 @@ static void wavIsPlay() {
|
||||
|
||||
*result = mus_wav_get_playposition(slot);
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavIsPlay %d,%p:", slot, result);
|
||||
TRACE("ShSound.wavIsPlay %d,%p:", slot, result);
|
||||
}
|
||||
|
||||
static void wavIsPlayRange() {
|
||||
@@ -347,7 +347,7 @@ static void wavIsPlayRange() {
|
||||
|
||||
*result = ret;
|
||||
|
||||
DEBUG_COMMAND("ShSound.wavIsPlayRange %d,%d,%p:", slot, range, result);
|
||||
TRACE("ShSound.wavIsPlayRange %d,%d,%p:", slot, range, result);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
+10
-10
@@ -46,35 +46,35 @@ static void ExchangeString(void) {
|
||||
int pat = getCaliValue();
|
||||
int patr = getCaliValue();
|
||||
svar_replaceAll(target, pat, patr);
|
||||
DEBUG_COMMAND("ShString.ExchangeString: %d,%d,%d:", target, pat, patr);
|
||||
TRACE("ShString.ExchangeString: %d,%d,%d:", target, pat, patr);
|
||||
}
|
||||
|
||||
static void SetNum16String(void) { /* 1 */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShString.SetNum16String: %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("ShString.SetNum16String: %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void SetNum16HalfString(void) { /* 2 */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShString.SetNum16HalfString: %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("ShString.SetNum16HalfString: %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void SetNum32String(void) { /* 3 */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShString.SetNum32String: %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("ShString.SetNum32String: %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void SetNum32HalfString(void) { /* 4 */
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShString.SetNum32HalfString: %d,%d:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("ShString.SetNum32HalfString: %d,%d:", p1, p2);
|
||||
}
|
||||
|
||||
static void GetArrayString(void) { /* 5 */
|
||||
@@ -82,7 +82,7 @@ static void GetArrayString(void) { /* 5 */
|
||||
int p2 = getCaliValue();
|
||||
int p3 = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("ShString.GetArrayString: %d,%d,%d:", p1, p2, p3);
|
||||
TRACE_UNIMPLEMENTED("ShString.GetArrayString: %d,%d,%d:", p1, p2, p3);
|
||||
}
|
||||
|
||||
static void SetWindowTitle(void) { /* 6 */
|
||||
@@ -93,7 +93,7 @@ static void SetWindowTitle(void) { /* 6 */
|
||||
ags_setWindowTitle(title_utf8);
|
||||
free(title_utf8);
|
||||
|
||||
DEBUG_COMMAND("ShString.SetWindowTitle: %d,%d:", strno, p2);
|
||||
TRACE("ShString.SetWindowTitle: %d,%d:", strno, p2);
|
||||
}
|
||||
|
||||
static void FillString() {
|
||||
@@ -115,7 +115,7 @@ static void FillString() {
|
||||
svar_set(st + i, svar_get(src));
|
||||
}
|
||||
|
||||
DEBUG_COMMAND("ShString.FillString: %d,%d,%d,%d:", st, cnt, src, p4);
|
||||
TRACE("ShString.FillString: %d,%d,%d,%d:", st, cnt, src, p4);
|
||||
}
|
||||
|
||||
static void SetStringNum16(void) {
|
||||
@@ -132,7 +132,7 @@ static void SetStringNum16(void) {
|
||||
char _dst[100];
|
||||
char *dst = _dst;
|
||||
|
||||
DEBUG_COMMAND("ShString.SetStringNum16: %d,%p:", st, var);
|
||||
TRACE("ShString.SetStringNum16: %d,%p:", st, var);
|
||||
|
||||
|
||||
while(*str) {
|
||||
@@ -162,7 +162,7 @@ static void SetStringNum32(void) {
|
||||
int p1 = getCaliValue();
|
||||
int *p2 = getCaliVariable();
|
||||
|
||||
DEBUG_COMMAND_YET("ShString.SetStringNum32: %d,%p:", p1, p2);
|
||||
TRACE_UNIMPLEMENTED("ShString.SetStringNum32: %d,%p:", p1, p2);
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user