mirror of
https://github.com/fallout2-ce/fallout2-ce.git
synced 2026-07-27 16:47:11 -07:00
Compare commits
286
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ee6c264c2 | ||
|
|
462063ca85 | ||
|
|
f17c61efa6 | ||
|
|
e996107403 | ||
|
|
933e5bf822 | ||
|
|
e084300713 | ||
|
|
325c86ddfc | ||
|
|
324957526f | ||
|
|
acd5d979c9 | ||
|
|
c2cd174516 | ||
|
|
4cb451de51 | ||
|
|
33c2cf268d | ||
|
|
b47af8de8d | ||
|
|
efd4f9e434 | ||
|
|
2d0a2047ba | ||
|
|
87e1d1f11b | ||
|
|
5d17e0ef89 | ||
|
|
2bf08228c5 | ||
|
|
571b43410d | ||
|
|
f0e6002df9 | ||
|
|
d593c481f2 | ||
|
|
76f3d82679 | ||
|
|
0e1270a606 | ||
|
|
55a32a00ab | ||
|
|
7b9b545baa | ||
|
|
a96edd9f0c | ||
|
|
55c528f346 | ||
|
|
5c28dc798f | ||
|
|
7ef6943588 | ||
|
|
40bbd6c02a | ||
|
|
45c491c11f | ||
|
|
18c05d438e | ||
|
|
c3a501a644 | ||
|
|
2767a399c5 | ||
|
|
1237d8561d | ||
|
|
89b6812711 | ||
|
|
339146c5b3 | ||
|
|
3949c5d7c1 | ||
|
|
84a64035e8 | ||
|
|
164be5105a | ||
|
|
d532e4c398 | ||
|
|
950c12dbf7 | ||
|
|
2be9b7db65 | ||
|
|
138ce8be9b | ||
|
|
96b9323a97 | ||
|
|
7c6d339e3d | ||
|
|
2ec8240820 | ||
|
|
ca72573c14 | ||
|
|
9974a23c1e | ||
|
|
cd6cce3f34 | ||
|
|
361b9a0b30 | ||
|
|
7c7cb87f65 | ||
|
|
20bcb2360c | ||
|
|
75dbc98321 | ||
|
|
d792cfa32e | ||
|
|
e81a07dcaf | ||
|
|
0d78119680 | ||
|
|
79d0fcfcaa | ||
|
|
2d5e69d740 | ||
|
|
b5cf3ee148 | ||
|
|
a571a985c6 | ||
|
|
6ccba74836 | ||
|
|
30c3af01f5 | ||
|
|
fd25944a9e | ||
|
|
41c5d77f89 | ||
|
|
75513058a5 | ||
|
|
0cf55eca75 | ||
|
|
e6cbdd5466 | ||
|
|
90f634b285 | ||
|
|
666ee6f41c | ||
|
|
4342aefa5d | ||
|
|
7224c7d7fb | ||
|
|
dff7529707 | ||
|
|
2435b33480 | ||
|
|
c4652d799a | ||
|
|
5140b00ccf | ||
|
|
f1ba068d05 | ||
|
|
01db7078c7 | ||
|
|
64fd857da6 | ||
|
|
555652d9c3 | ||
|
|
8c35203b7d | ||
|
|
0303a00299 | ||
|
|
dd16e374ee | ||
|
|
ce4495589b | ||
|
|
af350914ef | ||
|
|
8dd2afc4fa | ||
|
|
240aa8a212 | ||
|
|
c58b5eac1d | ||
|
|
0bd8a76b05 | ||
|
|
853266b380 | ||
|
|
0adc9c9e77 | ||
|
|
150e734955 | ||
|
|
d0ba0151d1 | ||
|
|
67c70661a6 | ||
|
|
9c4efeb59d | ||
|
|
ea0afc84fa | ||
|
|
c663d79b97 | ||
|
|
8bd87be687 | ||
|
|
8101c78e78 | ||
|
|
9b5737a14e | ||
|
|
3d4c073856 | ||
|
|
f868ac0e1a | ||
|
|
eaa9091bcd | ||
|
|
76ab99cf73 | ||
|
|
bed9555f9a | ||
|
|
9c5294ca88 | ||
|
|
781d8ab282 | ||
|
|
34ef1c2f26 | ||
|
|
fdc54cfd0b | ||
|
|
a63aff09ce | ||
|
|
3d2aced2f7 | ||
|
|
1d6111b89f | ||
|
|
21c906cc5c | ||
|
|
a67fe7ead1 | ||
|
|
f0691d2c24 | ||
|
|
fb30648e2e | ||
|
|
216cbb3861 | ||
|
|
be63df4bf6 | ||
|
|
4cf35fd946 | ||
|
|
dd418ee0f5 | ||
|
|
eb5cc7be4f | ||
|
|
8c6f28b018 | ||
|
|
2e36030389 | ||
|
|
a88ca9f7e7 | ||
|
|
72d9ae85c8 | ||
|
|
a8f2de1a56 | ||
|
|
51b82ac1ac | ||
|
|
0d97222797 | ||
|
|
b30463ab01 | ||
|
|
9d932b0d2c | ||
|
|
8d76b9655c | ||
|
|
0e6c4d9684 | ||
|
|
02c5efac26 | ||
|
|
b7933f6b80 | ||
|
|
fcb1680db2 | ||
|
|
ea4d978bc1 | ||
|
|
22548a3c70 | ||
|
|
7767aabdce | ||
|
|
9cb2b83db1 | ||
|
|
75ca12e07c | ||
|
|
f85e8ba67b | ||
|
|
07876ddaf9 | ||
|
|
7288f8eeb7 | ||
|
|
cd6ca76988 | ||
|
|
5d3cbd567a | ||
|
|
70ef1d4009 | ||
|
|
3acf0ac6c4 | ||
|
|
a73c336ead | ||
|
|
d46aea53bd | ||
|
|
1a46d0f59f | ||
|
|
7c2dfa9af1 | ||
|
|
3dc89d49e2 | ||
|
|
822d5dfd7d | ||
|
|
879634bf9c | ||
|
|
d681e7be69 | ||
|
|
795ef54d70 | ||
|
|
14b06d2dcc | ||
|
|
ed959edbbb | ||
|
|
7940ea791c | ||
|
|
3f270aa4cc | ||
|
|
8294e15d3c | ||
|
|
4278d1a1d0 | ||
|
|
b8769fded1 | ||
|
|
43d5b6028d | ||
|
|
b2675ad1ac | ||
|
|
da3f1cc426 | ||
|
|
a892461dac | ||
|
|
209d2d027b | ||
|
|
b8385d7775 | ||
|
|
a3c365f9fe | ||
|
|
87d4a4b8ca | ||
|
|
1aa53a4720 | ||
|
|
6bcf2952f6 | ||
|
|
e2927e1d0e | ||
|
|
bb839cd6c1 | ||
|
|
caa0e1bf1a | ||
|
|
f3759d07a5 | ||
|
|
604fde895f | ||
|
|
f46c391e5d | ||
|
|
5dafa019c9 | ||
|
|
8888fc46d6 | ||
|
|
001bdbee5c | ||
|
|
1e45b0184b | ||
|
|
40471e5a0b | ||
|
|
ad776876a1 | ||
|
|
224f1088f2 | ||
|
|
05b692f403 | ||
|
|
190906bb5f | ||
|
|
447ea23862 | ||
|
|
41dd2ccd81 | ||
|
|
72786c4d43 | ||
|
|
04e93cabd7 | ||
|
|
a31af0671d | ||
|
|
72df28f53a | ||
|
|
7e3bd36f86 | ||
|
|
94ce0fbe11 | ||
|
|
a368f27ad4 | ||
|
|
d8d411e847 | ||
|
|
5eef9af7a9 | ||
|
|
0419efad8f | ||
|
|
21f432afbb | ||
|
|
aed05c0daf | ||
|
|
8a8b54d4b7 | ||
|
|
8ee543ec16 | ||
|
|
161bb82f30 | ||
|
|
22bd1ffbba | ||
|
|
f46f1c78d4 | ||
|
|
3d0e206825 | ||
|
|
47a9891e0e | ||
|
|
f1e5cde84f | ||
|
|
015909fdef | ||
|
|
1e91b401f1 | ||
|
|
29a0be50f4 | ||
|
|
9e3ce4cd8d | ||
|
|
592882b7b8 | ||
|
|
3d3e47c9db | ||
|
|
a9726cab56 | ||
|
|
400aa4d8a3 | ||
|
|
cbd7b45736 | ||
|
|
599d3ab392 | ||
|
|
84336d4655 | ||
|
|
220fb8e190 | ||
|
|
5a29fc1815 | ||
|
|
a083779fb2 | ||
|
|
95d254cd45 | ||
|
|
0d8f4cc711 | ||
|
|
aabc971dd5 | ||
|
|
696e926177 | ||
|
|
30babd7e1f | ||
|
|
6ff0b411e4 | ||
|
|
9f623f3f3e | ||
|
|
d8bee457f4 | ||
|
|
fcabd63561 | ||
|
|
73c024c705 | ||
|
|
27da084b65 | ||
|
|
dfa610f352 | ||
|
|
a0a597725a | ||
|
|
7ae194a8ee | ||
|
|
b069e3b941 | ||
|
|
823f72492f | ||
|
|
e5f3734e08 | ||
|
|
e37522d388 | ||
|
|
07a361f63a | ||
|
|
515bec4c82 | ||
|
|
42bfdc7343 | ||
|
|
0fd5e59575 | ||
|
|
0d0578f111 | ||
|
|
dacda99b98 | ||
|
|
dfb0463b02 | ||
|
|
1903e04c6e | ||
|
|
abec3681b0 | ||
|
|
7f7e103465 | ||
|
|
5a9f8fb46c | ||
|
|
721e40f784 | ||
|
|
3659c834ae | ||
|
|
196553ec46 | ||
|
|
57f1229a51 | ||
|
|
413c843ff5 | ||
|
|
995102d515 | ||
|
|
dd867446ea | ||
|
|
4f91e38cc0 | ||
|
|
59c64451ff | ||
|
|
965f360578 | ||
|
|
3f79d79f25 | ||
|
|
cad023a73e | ||
|
|
7490c900b3 | ||
|
|
d8dc05597b | ||
|
|
7d9e1612c6 | ||
|
|
848bd97e42 | ||
|
|
5c5512277d | ||
|
|
016f853c0a | ||
|
|
9edbf0dd72 | ||
|
|
36af4b2ea8 | ||
|
|
67a6119f34 | ||
|
|
aa036c574e | ||
|
|
a17d7fb7d5 | ||
|
|
8ed777ba83 | ||
|
|
7c182b66a6 | ||
|
|
f6320d3a66 | ||
|
|
ec2ecd17d9 | ||
|
|
de06827c01 | ||
|
|
e3437a8d0e | ||
|
|
f12babe525 | ||
|
|
cb990ac154 | ||
|
|
a3fc8d21be | ||
|
|
cc805db194 |
@@ -0,0 +1,384 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request: # TODO: Remove this after debugging
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
android:
|
||||
name: Android Release
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 11
|
||||
cache: gradle
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: os/android/app/.cxx
|
||||
key: android-cmake-v101
|
||||
|
||||
- name: Setup signing config
|
||||
if: env.KEYSTORE_FILE_BASE64 != '' && env.KEYSTORE_PROPERTIES_FILE_BASE64 != ''
|
||||
run: |
|
||||
cd os/android
|
||||
echo "$KEYSTORE_FILE_BASE64" | base64 --decode > release.keystore
|
||||
echo "$KEYSTORE_PROPERTIES_FILE_BASE64" | base64 --decode > release-keystore.properties
|
||||
env:
|
||||
KEYSTORE_FILE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_FILE_BASE64 }}
|
||||
KEYSTORE_PROPERTIES_FILE_BASE64: ${{ secrets.ANDROID_RELEASE_KEYSTORE_PROPERTIES_FILE_BASE64 }}
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cd os/android
|
||||
./gradlew assembleRelease
|
||||
|
||||
- name: Change apk file name
|
||||
run: |
|
||||
ls -laR .
|
||||
mv os/android/app/build/outputs/apk/release/app-release.apk os/android/app/build/outputs/apk/release/fallout2-ce.apk
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce.apk
|
||||
path: os/android/app/build/outputs/apk/release/fallout2-ce.apk
|
||||
retention-days: 7
|
||||
|
||||
ios:
|
||||
name: iOS Release
|
||||
|
||||
runs-on: macos-14
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: ios-cmake-v101
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake --preset ios
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build --preset ios-release
|
||||
|
||||
- name: Pack
|
||||
run: |
|
||||
ls -laR .
|
||||
cd out/build/ios
|
||||
# cpack -C Release # No need, we already have .ipa
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce.ipa
|
||||
path: out/build/ios/fallout2-ce.ipa
|
||||
retention-days: 7
|
||||
|
||||
linux:
|
||||
name: Linux ${{ matrix.arch }} Release
|
||||
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch:
|
||||
- x86
|
||||
- x64
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Dependencies (x86)
|
||||
if: matrix.arch == 'x86'
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt update
|
||||
sudo apt install g++-multilib libsdl2-dev:i386 zlib1g-dev:i386
|
||||
|
||||
- name: Dependencies (x64)
|
||||
if: matrix.arch == 'x64'
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libsdl2-dev zlib1g-dev
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: linux-${{ matrix.arch }}-cmake-v101
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake --preset linux-${{ matrix.arch }}-release
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build --preset linux-${{ matrix.arch }}-release
|
||||
|
||||
- name: Change executable file name
|
||||
run: |
|
||||
mv out/build/linux-${{ matrix.arch }}-release/fallout2-ce out/build/linux-${{ matrix.arch }}-release/fallout2-ce-linux-${{ matrix.arch }}
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-linux-${{ matrix.arch }}
|
||||
path: out/build/linux-${{ matrix.arch }}-release/fallout2-ce-linux-${{ matrix.arch }}
|
||||
retention-days: 7
|
||||
|
||||
linux-armhf:
|
||||
name: Linux armhf Release
|
||||
|
||||
runs-on: ubuntu-22.04-arm
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Dependencies
|
||||
run: |
|
||||
sudo dpkg --add-architecture armhf
|
||||
sudo apt update
|
||||
sudo apt install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libsdl2-dev:armhf zlib1g-dev:armhf
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake \
|
||||
-B build \
|
||||
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-D FALLOUT_VENDORED=OFF \
|
||||
-D CMAKE_SYSTEM_PROCESSOR=arm \
|
||||
-D CMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \
|
||||
-D CMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \
|
||||
# EOL
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
|
||||
- name: Change executable file name
|
||||
run: |
|
||||
mv build/fallout2-ce build/fallout2-ce-linux-armhf
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-linux-armhf
|
||||
path: build/fallout2-ce-linux-armhf
|
||||
retention-days: 7
|
||||
|
||||
linux-arm64:
|
||||
name: Linux arm64 Release
|
||||
runs-on: ubuntu-22.04-arm
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install libsdl2-dev zlib1g-dev
|
||||
|
||||
- name: Configure
|
||||
run: cmake -B build -D CMAKE_BUILD_TYPE=RelWithDebInfo -D FALLOUT_VENDORED=OFF
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
|
||||
- name: Change executable file name
|
||||
run: |
|
||||
mv build/fallout2-ce build/fallout2-ce-linux-arm64
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-linux-arm64
|
||||
path: build/fallout2-ce-linux-arm64
|
||||
retention-days: 7
|
||||
|
||||
macos:
|
||||
name: macOS Release
|
||||
|
||||
runs-on: macos-14
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: macos-cmake-v101
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake --preset macos
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake --build --preset macos-release
|
||||
|
||||
- name: Pack
|
||||
run: |
|
||||
ls -laR .
|
||||
cd out/build/macos
|
||||
# cpack -C Release # There is already .dmg in the folder
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-macos.dmg
|
||||
path: out/build/macos/Fallout II Community Edition.dmg
|
||||
retention-days: 7
|
||||
|
||||
windows:
|
||||
name: Windows ${{ matrix.arch }} Release
|
||||
|
||||
runs-on: windows-2025
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: x86
|
||||
generator-platform: Win32
|
||||
- arch: x64
|
||||
generator-platform: x64
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Visual Studio 2019 Build Tools with v141_xp
|
||||
shell: cmd
|
||||
run: |
|
||||
choco install visualstudio2019buildtools -y --package-parameters="'--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.xp --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.10240 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Component.WinXP'"
|
||||
|
||||
# - name: Cache cmake build
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: out
|
||||
# key: windows-${{ matrix.arch }}-cmake-v101
|
||||
|
||||
- name: Configure
|
||||
shell: cmd
|
||||
run: |
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" ^
|
||||
&& cmake --preset windows-${{ matrix.arch }}
|
||||
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" ^
|
||||
&& cmake --build --preset windows-${{ matrix.arch }}-release
|
||||
|
||||
- name: Change executable file name
|
||||
run: |
|
||||
mv out/build/windows-${{ matrix.arch }}/RelWithDebInfo/fallout2-ce.exe out/build/windows-${{ matrix.arch }}/RelWithDebInfo/fallout2-ce-${{ matrix.arch }}.exe
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-windows-${{ matrix.arch }}
|
||||
path: out/build/windows-${{ matrix.arch }}/RelWithDebInfo/fallout2-ce-${{ matrix.arch }}.exe
|
||||
retention-days: 7
|
||||
|
||||
|
||||
release:
|
||||
name: Release Continuous build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [android, ios, linux, linux-armhf, linux-arm64, macos, windows]
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Fetch artifacts
|
||||
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
||||
uses: actions/download-artifact@v4.1.7
|
||||
with:
|
||||
path: artifacts/
|
||||
|
||||
- name: Remove old release
|
||||
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
||||
uses: dev-drprasad/delete-tag-and-release@v0.2.1
|
||||
with:
|
||||
delete_release: true
|
||||
tag_name: continious
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Move unpacked artifacts to root folder
|
||||
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
||||
run: |
|
||||
ls -Rlah .
|
||||
find .
|
||||
cd artifacts/
|
||||
for folder in *; do
|
||||
if [[ -d "$folder" && "$folder" != "." ]]; then
|
||||
echo "Processing $folder"
|
||||
mv "$folder" "$folder.dir"
|
||||
cd "$folder.dir"
|
||||
for file in *; do
|
||||
if [ -f "$file" ]; then
|
||||
if [ -f "../$file" ]; then
|
||||
echo "ERROR: Duplicate artifact file name $file"
|
||||
exit 1
|
||||
fi
|
||||
if [ -d "../$file" ]; then
|
||||
echo "ERROR: Duplicate artifact folder $file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Moving $file"
|
||||
mv "$file" "../$file"
|
||||
fi
|
||||
done
|
||||
cd ..
|
||||
rm -rf "$folder.dir"
|
||||
fi
|
||||
done
|
||||
ls -Rlah .
|
||||
find .
|
||||
cd ../
|
||||
|
||||
- name: Allow GitHub to process removed release for few seconds
|
||||
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
||||
run: |
|
||||
sleep 20s
|
||||
|
||||
- name: Upload new release
|
||||
if: ${{ always() && github.ref == 'refs/heads/main' && github.event_name == 'push' }}
|
||||
uses: softprops/action-gh-release@v0.1.15
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
files: artifacts/*
|
||||
tag_name: continious
|
||||
draft: false
|
||||
prerelease: false
|
||||
name: Fallout2-CE Continuous Build
|
||||
@@ -14,6 +14,16 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: start deployment
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
||||
uses: bobheadxi/deployments@v1
|
||||
id: deployment
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
step: start
|
||||
debug: true
|
||||
env: preview-${{ github.event.pull_request.number }}
|
||||
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -76,6 +86,10 @@ jobs:
|
||||
SITE_BASE: ${{ steps.set-path.outputs.SITE_BASE }}
|
||||
F2_GAME_VERSION: Game=${{github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
- name: Place hash file
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
run: echo "$GITHUB_SHA" > fallout2-ce-ems/dist/site_hash.txt
|
||||
|
||||
- name: Install rsync (required for the next step)
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
run: |
|
||||
@@ -89,11 +103,39 @@ jobs:
|
||||
folder: fallout2-ce-ems/dist
|
||||
target-folder: ${{ steps.set-path.outputs.DEST_DIR }}
|
||||
clean: false
|
||||
single-commit: true
|
||||
|
||||
- name: Comment preview URL on PR
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
||||
|
||||
|
||||
- name: Check that site is deployed
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
run: |
|
||||
gh pr comment ${{ github.event.pull_request.number }} \
|
||||
--body "🚀 WebAssembly PR Preview for ${{github.event.pull_request.head.sha || github.sha }} is available at: https://${{ github.repository_owner }}.github.io/fallout2-ce/PR-${{ github.event.pull_request.number }}/"
|
||||
URL="$SITE_ORIGIN""$SITE_BASE""site_hash.txt"
|
||||
echo "Expecting $GITHUB_SHA from $URL"
|
||||
for i in `seq 1 80`; do
|
||||
got="$(curl -fsSL --max-time 10 "$URL" | tr -d '\r\n' || true)"
|
||||
if [ "$got" = "$GITHUB_SHA" ]; then
|
||||
echo "âś… Match on attempt $i: ${got}"
|
||||
exit 0
|
||||
fi
|
||||
echo "Received $got, waiting"
|
||||
sleep 5
|
||||
done
|
||||
exit 1
|
||||
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SITE_ORIGIN: https://${{ github.repository_owner }}.github.io
|
||||
SITE_BASE: ${{ steps.set-path.outputs.SITE_BASE }}
|
||||
|
||||
- name: Update deployment status
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
||||
uses: bobheadxi/deployments@v1
|
||||
with:
|
||||
step: finish
|
||||
status: success
|
||||
debug: true
|
||||
env: ${{ steps.deployment.outputs.env }}
|
||||
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
env_url: https://${{ github.repository_owner }}.github.io/fallout2-ce/PR-${{ github.event.pull_request.number }}/
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: os/android/app/.cxx
|
||||
key: android-cmake-v2
|
||||
key: android-cmake-v101
|
||||
|
||||
- name: Setup signing config
|
||||
if: env.KEYSTORE_FILE_BASE64 != '' && env.KEYSTORE_PROPERTIES_FILE_BASE64 != ''
|
||||
@@ -106,13 +106,13 @@ jobs:
|
||||
|
||||
- name: Change apk file name
|
||||
run: |
|
||||
mv os/android/app/build/outputs/apk/debug/app-debug.apk os/android/app/build/outputs/apk/debug/fallout2-ce.apk
|
||||
mv os/android/app/build/outputs/apk/debug/app-debug.apk os/android/app/build/outputs/apk/debug/fallout2-ce-debug.apk
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-debug.apk
|
||||
path: os/android/app/build/outputs/apk/debug/fallout2-ce.apk
|
||||
path: os/android/app/build/outputs/apk/debug/fallout2-ce-debug.apk
|
||||
retention-days: 7
|
||||
|
||||
ios:
|
||||
@@ -128,7 +128,7 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: ios-cmake-v5
|
||||
key: ios-cmake-v101
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
@@ -142,12 +142,13 @@ jobs:
|
||||
run: |
|
||||
cd out/build/ios
|
||||
cpack -C Debug
|
||||
mv fallout2-ce.ipa fallout2-ce-debug.ipa
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce.ipa
|
||||
path: out/build/ios/fallout2-ce.ipa
|
||||
name: fallout2-ce-debug.ipa
|
||||
path: out/build/ios/fallout2-ce-debug.ipa
|
||||
retention-days: 7
|
||||
|
||||
linux:
|
||||
@@ -183,7 +184,7 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: linux-${{ matrix.arch }}-cmake-v3
|
||||
key: linux-${{ matrix.arch }}-cmake-v101
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
@@ -200,7 +201,7 @@ jobs:
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-linux-${{ matrix.arch }}
|
||||
name: fallout2-ce-linux-${{ matrix.arch }}-debug
|
||||
path: out/build/linux-${{ matrix.arch }}-debug/fallout2-ce-linux-${{ matrix.arch }}
|
||||
retention-days: 7
|
||||
|
||||
@@ -235,13 +236,13 @@ jobs:
|
||||
|
||||
- name: Change executable file name
|
||||
run: |
|
||||
mv build/fallout2-ce build/fallout2-ce-linux-armhf
|
||||
mv build/fallout2-ce build/fallout2-ce-linux-armhf-debug
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-linux-armhf
|
||||
path: build/fallout2-ce-linux-armhf
|
||||
name: fallout2-ce-linux-armhf-debug
|
||||
path: build/fallout2-ce-linux-armhf-debug
|
||||
retention-days: 7
|
||||
|
||||
linux-arm64:
|
||||
@@ -266,13 +267,13 @@ jobs:
|
||||
|
||||
- name: Change executable file name
|
||||
run: |
|
||||
mv build/fallout2-ce build/fallout2-ce-linux-arm64
|
||||
mv build/fallout2-ce build/fallout2-ce-linux-arm64-debug
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-linux-arm64
|
||||
path: build/fallout2-ce-linux-arm64
|
||||
name: fallout2-ce-linux-arm64-debug
|
||||
path: build/fallout2-ce-linux-arm64-debug
|
||||
retention-days: 7
|
||||
|
||||
macos:
|
||||
@@ -288,7 +289,7 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: macos-cmake-v6
|
||||
key: macos-cmake-v101
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
@@ -302,18 +303,19 @@ jobs:
|
||||
run: |
|
||||
cd out/build/macos
|
||||
cpack -C Debug
|
||||
mv "Fallout II Community Edition.dmg" "Fallout II Community Edition Debug.dmg"
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-macos.dmg
|
||||
path: out/build/macos/Fallout II Community Edition.dmg
|
||||
name: fallout2-ce-macos-debug.dmg
|
||||
path: out/build/macos/Fallout II Community Edition Debug.dmg
|
||||
retention-days: 7
|
||||
|
||||
windows:
|
||||
name: Windows (${{ matrix.arch }})
|
||||
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-2025
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -328,34 +330,43 @@ jobs:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: windows-${{ matrix.arch }}-cmake-v2
|
||||
- name: Install Visual Studio 2019 Build Tools with v141_xp
|
||||
shell: cmd
|
||||
run: |
|
||||
choco install visualstudio2019buildtools -y --package-parameters="'--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.xp --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.10240 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Component.WinXP'"
|
||||
|
||||
# - name: Cache cmake build
|
||||
# uses: actions/cache@v4
|
||||
# with:
|
||||
# path: out
|
||||
# key: windows-${{ matrix.arch }}-cmake-v102
|
||||
|
||||
- name: Configure
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake --preset windows-${{ matrix.arch }}
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" ^
|
||||
&& cmake --preset windows-${{ matrix.arch }}
|
||||
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake --build --preset windows-${{ matrix.arch }}-release
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" ^
|
||||
&& cmake --build --preset windows-${{ matrix.arch }}-debug
|
||||
|
||||
- name: Change executable file name
|
||||
run: |
|
||||
mv out/build/windows-${{ matrix.arch }}/RelWithDebInfo/fallout2-ce.exe out/build/windows-${{ matrix.arch }}/RelWithDebInfo/fallout2-ce-${{ matrix.arch }}.exe
|
||||
mv out/build/windows-${{ matrix.arch }}/Debug/fallout2-ce.exe out/build/windows-${{ matrix.arch }}/Debug/fallout2-ce-${{ matrix.arch }}-debug.exe
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fallout2-ce-windows-${{ matrix.arch }}
|
||||
path: out/build/windows-${{ matrix.arch }}/RelWithDebInfo/fallout2-ce-${{ matrix.arch }}.exe
|
||||
name: fallout2-ce-windows-${{ matrix.arch }}-debug
|
||||
path: out/build/windows-${{ matrix.arch }}/Debug/fallout2-ce-${{ matrix.arch }}-debug.exe
|
||||
retention-days: 7
|
||||
|
||||
|
||||
release:
|
||||
name: Release Continuous build
|
||||
name: Debug Release Continuous build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [android, ios, linux, linux-armhf, linux-arm64, macos, windows]
|
||||
permissions: write-all
|
||||
@@ -371,7 +382,7 @@ jobs:
|
||||
uses: dev-drprasad/delete-tag-and-release@v0.2.1
|
||||
with:
|
||||
delete_release: true
|
||||
tag_name: continious
|
||||
tag_name: continious-debug
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -420,7 +431,7 @@ jobs:
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
files: artifacts/*
|
||||
tag_name: continious
|
||||
tag_name: continious-debug
|
||||
draft: false
|
||||
prerelease: true
|
||||
name: Fallout2-CE Continuous Build
|
||||
@@ -12,6 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
deployments: write
|
||||
steps:
|
||||
- name: Checkout gh-pages branch
|
||||
uses: actions/checkout@v4
|
||||
@@ -29,5 +30,26 @@ jobs:
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git commit -am "đźš® Remove preview for closed PR #${{ github.event.pull_request.number }}"
|
||||
git push
|
||||
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
echo "Current branch: $CURRENT_BRANCH"
|
||||
|
||||
if [ "$CURRENT_BRANCH" != "gh-pages" ]; then
|
||||
echo "❌ Refusing to force-push to non-gh-pages branch: $CURRENT_BRANCH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if git diff --cached --quiet; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
git commit --amend -m "đźš® Remove preview for closed PR #${{ github.event.pull_request.number }}"
|
||||
git push --force
|
||||
fi
|
||||
|
||||
- name: mark environment as deactivated
|
||||
uses: bobheadxi/deployments@v1
|
||||
with:
|
||||
step: deactivate-env
|
||||
env: preview-${{ github.event.pull_request.number }}
|
||||
desc: Environment was pruned
|
||||
debug: true
|
||||
|
||||
@@ -243,7 +243,7 @@ jobs:
|
||||
windows:
|
||||
name: Windows (${{ matrix.arch }})
|
||||
|
||||
runs-on: windows-2019
|
||||
runs-on: windows-2025
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -258,6 +258,11 @@ jobs:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Visual Studio 2019 Build Tools with v141_xp
|
||||
shell: cmd
|
||||
run: |
|
||||
choco install visualstudio2019buildtools -y --package-parameters="'--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.xp --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.10240 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Component.WinXP'"
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
@@ -265,19 +270,16 @@ jobs:
|
||||
key: windows-${{ matrix.arch }}-cmake-v1
|
||||
|
||||
- name: Configure
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake \
|
||||
-B build \
|
||||
-G "Visual Studio 16 2019" \
|
||||
-A ${{ matrix.generator-platform }} \
|
||||
# EOL
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" ^
|
||||
&& cmake -B build -G "Visual Studio 16 2019" -A ${{ matrix.generator-platform }}
|
||||
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
cmake \
|
||||
--build build \
|
||||
--config RelWithDebInfo \
|
||||
# EOL
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" ^
|
||||
&& cmake --build build --config RelWithDebInfo
|
||||
|
||||
- name: Upload
|
||||
run: |
|
||||
|
||||
@@ -288,10 +288,16 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
|
||||
"src/sfall_opcodes.h"
|
||||
"src/sfall_arrays.cc"
|
||||
"src/sfall_arrays.h"
|
||||
"src/sfall_callbacks.cc"
|
||||
"src/sfall_callbacks.h"
|
||||
"src/touch.cc"
|
||||
"src/touch.h"
|
||||
"src/scan_unimplemented.cc"
|
||||
"third_party/lodepng/lodepng.cpp"
|
||||
)
|
||||
|
||||
target_include_directories(${EXECUTABLE_NAME} PUBLIC "third_party/lodepng")
|
||||
|
||||
if(IOS)
|
||||
target_sources(${EXECUTABLE_NAME} PUBLIC
|
||||
"src/platform/ios/paths.h"
|
||||
|
||||
@@ -44,7 +44,7 @@ $ sudo apt install libsdl2-2.0-0
|
||||
|
||||
- Alternatively you can use Fallout 2 from Macplay/The Omni Group as a base - you need to extract game assets from the original bundle. Mount CD/DMG, right click `Fallout 2` -> `Show Package Contents`, navigate to `Contents/Resources`. Copy `GameData` folder somewhere, for example `/Applications/Fallout2`.
|
||||
|
||||
- Or if you're a Terminal user and have Homebrew installed you can extract the needed files from the GoG installer:
|
||||
- Or if you're a Terminal user and have Homebrew installed you can extract the needed files from the GoG installer. **Note**: You must use "Offline backup game installer", not the main game installer.
|
||||
|
||||
```console
|
||||
$ brew install innoextract
|
||||
@@ -125,7 +125,7 @@ IFACE_BAR_SIDES_ORI=0
|
||||
;This will increase the width of the interface bar expanding the area used to display text.
|
||||
;if IFACE_BAR_WIDTH=640 - Interface bar will remain at it's original width.
|
||||
;if IFACE_BAR_WIDTH=800 - Interface bar will use 800pix wide asset from f2_res.dat.
|
||||
IFACE_BAR_WIDTH=640
|
||||
;IFACE_BAR_WIDTH=640
|
||||
```
|
||||
|
||||
Recommendations:
|
||||
|
||||
+2
-1
@@ -4,7 +4,8 @@
|
||||
[Main]
|
||||
|
||||
;Set to one to hide areas outside map bounds when using higher than 640x480 resolution, and to zero to disable
|
||||
;HiResMode=1
|
||||
;EnableHighResolutionStencil=1
|
||||
|
||||
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Misc]
|
||||
|
||||
+32
-14
@@ -4,30 +4,48 @@
|
||||
|
||||
This folder contains scripts which can be used for sFall opcodes.
|
||||
|
||||
## Build script using sFall Script Editor
|
||||
## Building
|
||||
|
||||
1. Get "Fallout sFall Script Editor v4.1.7.RC1", for example from https://nuclear-grot.ucoz.net/forum/12-20-1
|
||||
Get latest `compile.exe` from [modders pack](https://sourceforge.net/projects/sfall/files/Modders%20pack/) or from [repository](https://github.com/sfall-team/sslc) and run it this way:
|
||||
|
||||
2. Run script editor, add "sfall_headers" into "Location folder of headers files" in the options
|
||||
```sh
|
||||
compile.exe -q -p -l -O2 -d -s -n -I<sfall_headers_id> <script_name.ssl>
|
||||
```
|
||||
|
||||
3. Open any script here and compile it
|
||||
(sfall headers can be found in modderspack)
|
||||
|
||||
|
||||
### Build script using sFall Script Editor
|
||||
|
||||
- Get "Fallout sFall Script Editor v4.1.7.RC1", for example from https://nuclear-grot.ucoz.net/forum/12-20-1
|
||||
|
||||
- Run script editor, add "sfall_headers" into "Location folder of headers files" in the options
|
||||
|
||||
- Open any script here and compile it
|
||||
|
||||
- This shoud create compiled script <file.int>
|
||||
|
||||
|
||||
### Build script using VSCode extension
|
||||
|
||||
- Install [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=BGforge.bgforge-mls)
|
||||
|
||||
4. This shoud create compiled script <file.int>
|
||||
|
||||
|
||||
## Run test script
|
||||
|
||||
1. Move compiled .int file into game folder as `mods/tests/SCRIPTS/OBJ_DUDE.INT` (case-sensitive!)
|
||||
1. Move compiled `.int` file into game folder as `data/scripts/gl_<script_name>.int`
|
||||
|
||||
2. Change `mods/mods_order.txt` file: add a line `tests` there
|
||||
2. Change `ddraw.ini` and add this section:
|
||||
```ini
|
||||
[Scripts]
|
||||
GlobalScriptPaths=data/scripts/gl*.int
|
||||
```
|
||||
|
||||
(or add new path using comma as separator)
|
||||
|
||||
Note that on non-Windows it have to be `/` as folder separator
|
||||
|
||||
3. Run game, check that game displays message about tests
|
||||
|
||||
4. Comment tests line in `mods/mods_order.txt` in order to enable game back
|
||||
|
||||
|
||||
|
||||
## TODO
|
||||
|
||||
- Use custom global script instead of `obj_dude`
|
||||
- Add note about compile.exe and https://marketplace.visualstudio.com/items?itemName=BGforge.bgforge-mls
|
||||
|
||||
@@ -1,30 +1,8 @@
|
||||
#include "lib.arrays.h"
|
||||
|
||||
#include "test_utils.h"
|
||||
// #include "define_lite.h"
|
||||
|
||||
|
||||
variable test_suite_errors := 0;
|
||||
variable test_suite_verbose := true;
|
||||
|
||||
#ifndef assertEquals
|
||||
procedure assertEquals(variable desc, variable a, variable b) begin
|
||||
if (a != b or typeof(a) != typeof(b)) then begin
|
||||
display_msg("Assertion failed \""+desc+"\": "+a+" != "+b);
|
||||
test_suite_errors ++;
|
||||
end else if (test_suite_verbose) then begin
|
||||
display_msg("Assert \""+desc+"\" ok");
|
||||
end
|
||||
end
|
||||
|
||||
procedure assertNotEquals(variable desc, variable a, variable b) begin
|
||||
if (a == b) then begin
|
||||
display_msg("Assertion failed \""+desc+"\": "+a+" == "+b);
|
||||
test_suite_errors ++;
|
||||
end else if (test_suite_verbose) then begin
|
||||
display_msg("Assert \""+desc+"\" ok");
|
||||
end
|
||||
end
|
||||
#endif
|
||||
|
||||
#define ARRAY_MAX_STRING (255)
|
||||
#define ARRAY_MAX_SIZE (100000)
|
||||
@@ -187,6 +165,8 @@ procedure array_test_suite begin
|
||||
*/
|
||||
|
||||
display_msg("All tests finished with "+test_suite_errors+" errors.");
|
||||
|
||||
call report_test_results("arrays");
|
||||
end
|
||||
|
||||
|
||||
@@ -195,7 +175,7 @@ end
|
||||
|
||||
|
||||
|
||||
procedure map_enter_p_proc begin
|
||||
procedure start begin
|
||||
display_msg("Starting tests");
|
||||
call array_test_suite();
|
||||
end
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "test_utils.h"
|
||||
#include "sfall.h"
|
||||
|
||||
procedure start begin
|
||||
display_msg("Testing iface_tag functions...");
|
||||
// assumes no iface tags active in the save game
|
||||
|
||||
// SNEAK
|
||||
show_iface_tag(0);
|
||||
call assertTrue("show_iface_tag(SNEAK)", is_iface_tag_active(0));
|
||||
hide_iface_tag(0);
|
||||
call assertFalse("hide_iface_tag(SNEAK)", is_iface_tag_active(0));
|
||||
|
||||
// LEVEL
|
||||
show_iface_tag(3);
|
||||
call assertTrue("show_iface_tag(LEVEL)", is_iface_tag_active(3));
|
||||
hide_iface_tag(3);
|
||||
call assertFalse("hide_iface_tag(LEVEL)", is_iface_tag_active(3));
|
||||
|
||||
// ADDICTED
|
||||
show_iface_tag(4);
|
||||
call assertTrue("show_iface_tag(ADDICTED)", is_iface_tag_active(4));
|
||||
hide_iface_tag(4);
|
||||
call assertFalse("hide_iface_tag(ADDICTED)", is_iface_tag_active(4));
|
||||
|
||||
// POISONED
|
||||
call assertFalse("hide_iface_tag(POISONED)", is_iface_tag_active(1));
|
||||
|
||||
// RADIATED
|
||||
call assertFalse("hide_iface_tag(RADIATED)", is_iface_tag_active(2));
|
||||
|
||||
call report_test_results("iface_tag");
|
||||
end
|
||||
@@ -0,0 +1,69 @@
|
||||
#include "lib.arrays.h" // For arrays_equal, len_array, etc.
|
||||
#include "test_utils.h" // For assertEquals, VALTYPE_STR, report_test_results
|
||||
|
||||
// To test: copy test.ini into the game folder before running
|
||||
procedure ini_test_suite begin
|
||||
variable result_array, expected_array, key_type, value_type, count, key_val_pair;
|
||||
|
||||
display_msg("--- Testing ini functions");
|
||||
|
||||
// Test Case 1: Valid file, valid section
|
||||
result_array := get_ini_section("test.ini", "ValidSection");
|
||||
expected_array := {"Key1": "Value1", "Key2": "2"};
|
||||
call assertEquals("TC1 Size", len_array(result_array), 2);
|
||||
call assertEquals("TC1 Content", arrays_equal(result_array, expected_array), true);
|
||||
count := 0;
|
||||
foreach key_val_pair in result_array begin
|
||||
count += 1;
|
||||
call assertEquals("TC1 Key Type " + count, typeof(key_val_pair[0]), VALTYPE_STR);
|
||||
call assertEquals("TC1 Value Type " + count, typeof(key_val_pair[1]), VALTYPE_STR);
|
||||
end
|
||||
|
||||
// basic fetchers
|
||||
call assertEquals("TC2 Specific Key1 Value", result_array["Key1"], "Value1");
|
||||
call assertEquals("TC2 get_ini_setting string", get_ini_setting("test.ini|ValidSection|Key1"), 0);
|
||||
call assertEquals("TC2 get_ini_string string", get_ini_string("test.ini|ValidSection|Key1"), "Value1");
|
||||
call assertEquals("TC2 get_ini_setting int", get_ini_setting("test.ini|ValidSection|Key2"), 2);
|
||||
call assertEquals("TC2 get_ini_string int", get_ini_string("test.ini|ValidSection|Key2"), "2");
|
||||
|
||||
// INI file not found
|
||||
result_array := get_ini_section("nonexistent.ini", "AnySection");
|
||||
call assertEquals("TC3 Size", len_array(result_array), 0);
|
||||
call assertEquals("TC3 Is Map", array_key(result_array, -1), 1); // Should still be an associative array
|
||||
call assertEquals("TC3 get_ini_setting", get_ini_setting("notexist.ini|ValidSection|Key2"), 0);
|
||||
call assertEquals("TC3 get_ini_string", get_ini_string("notexist.ini|ValidSection|Key2"), "");
|
||||
|
||||
// Valid file, section not found
|
||||
result_array := get_ini_section("test.ini", "NonExistentSection");
|
||||
call assertEquals("TC4 Size", len_array(result_array), 0);
|
||||
call assertEquals("TC4 Is Map", array_key(result_array, -1), 1);
|
||||
call assertEquals("TC4 get_ini_setting", get_ini_setting("test.ini|NonExistentSection|Key2"), 0);
|
||||
call assertEquals("TC4 get_ini_string", get_ini_string("test.ini|NonExistentSection|Key2"), "");
|
||||
|
||||
|
||||
// Valid file, empty section
|
||||
result_array := get_ini_section("test.ini", "EmptySection");
|
||||
call assertEquals("TC5 Size", len_array(result_array), 0);
|
||||
call assertEquals("TC5 Is Map", array_key(result_array, -1), 1);
|
||||
call assertEquals("TC5 get_ini_setting", get_ini_setting("test.ini|EmptySection|Key2"), 0);
|
||||
call assertEquals("TC5 get_ini_string", get_ini_string("test.ini|EmptySection|Key2"), "");
|
||||
|
||||
// set ini setting
|
||||
set_ini_setting("test_set.ini|ValidSection|Key3", "OldValue");
|
||||
call assertEquals("TC6 set_ini_setting 1", get_ini_string("test_set.ini|ValidSection|Key3"), "OldValue");
|
||||
set_ini_setting("test_set.ini|ValidSection|Key3", "NewValue");
|
||||
call assertEquals("TC6 set_ini_setting 2", get_ini_string("test_set.ini|ValidSection|Key3"), "NewValue");
|
||||
set_ini_setting("test_set.ini|ValidSection|Key3", 2);
|
||||
call assertEquals("TC6 set_ini_setting int", get_ini_setting("test_set.ini|ValidSection|Key3"), 2);
|
||||
|
||||
// get_init_sections
|
||||
result_array := get_ini_sections("test.ini");
|
||||
call assertEquals("TC7 get_ini_sections size", len_array(result_array), 3);
|
||||
call assertTrue("TC7 get_ini_sections", scan_array(result_array, "TestMisc") >= 0);
|
||||
|
||||
call report_test_results("ini");
|
||||
end
|
||||
|
||||
procedure start begin
|
||||
call ini_test_suite();
|
||||
end
|
||||
@@ -0,0 +1,71 @@
|
||||
#include "test_utils.h"
|
||||
#include "sfall.h"
|
||||
|
||||
procedure start begin
|
||||
|
||||
display_msg("Testing math functions...");
|
||||
|
||||
call assertFloat("sin(0)", sin(0), 0.0);
|
||||
call assertFloat("sin(PI/2)", sin(1.5708), 1.0);
|
||||
call assertFloat("sin(PI)", sin(3.1416), 0.0);
|
||||
call assertFloat("sin(-PI/2)", sin(-1.5708), -1.0);
|
||||
|
||||
call assertFloat("cos(0)", cos(0), 1.0);
|
||||
call assertFloat("cos(PI/2)", cos(1.5708), 0.0);
|
||||
call assertFloat("cos(PI)", cos(3.1416), -1.0);
|
||||
call assertFloat("cos(-PI)", cos(-3.1416), -1.0);
|
||||
|
||||
call assertFloat("tan(0)", tan(0), 0.0);
|
||||
call assertFloat("tan(PI/4)", tan(0.7854), 1.0);
|
||||
call assertFloat("tan(-PI/4)", tan(-0.7854), -1.0);
|
||||
|
||||
call assertFloat("arctan(0, 1)", arctan(0, 1), 0.0);
|
||||
call assertFloat("arctan(1, 1)", arctan(1, 1), 0.7854);
|
||||
call assertFloat("arctan(-1, 1)", arctan(-1, 1), -0.7854);
|
||||
call assertFloat("arctan(1, 0)", arctan(1, 0), 1.5708);
|
||||
|
||||
call assertFloat("log(1)", log(1), 0.0);
|
||||
call assertFloat("log(e)", log(2.7183), 1.0);
|
||||
call assertFloat("log(10)", log(10), 2.3026);
|
||||
|
||||
call assertFloat("exponent(0)", exponent(0), 1.0);
|
||||
call assertFloat("exponent(1)", exponent(1), 2.7183);
|
||||
call assertFloat("exponent(2)", exponent(2), 7.3891);
|
||||
call assertFloat("exponent(-1)", exponent(-1), 0.3679);
|
||||
|
||||
call assertEquals("ceil(2.1)", ceil(2.1), 3);
|
||||
call assertEquals("ceil(2.0)", ceil(2.0), 2);
|
||||
call assertEquals("ceil(-2.1)", ceil(-2.1), -2);
|
||||
call assertEquals("ceil(-2.9)", ceil(-2.9), -2);
|
||||
|
||||
call assertEquals("floor2(2.1)", floor2(2.1), 2);
|
||||
call assertEquals("floor2(2.9)", floor2(2.9), 2);
|
||||
call assertEquals("floor2(-2.1)", floor2(-2.1), -3);
|
||||
call assertEquals("floor2(-2.9)", floor2(-2.9), -3);
|
||||
|
||||
call assertEquals("2^3", 2^3, 8);
|
||||
call assertEquals("4^2", 4^2, 16);
|
||||
call assertEquals("3^0", 3^0, 1);
|
||||
call assertFloat("2^-1", 2^-1, 0); // note: int truncation
|
||||
call assertFloat("2^-1", 2^-1.0, 0.5);
|
||||
call assertFloat("4^0.5", 4^0.5, 2.0);
|
||||
call assertFloat("8^(1/3)", 8^(1.0/3.0), 2.0);
|
||||
call assertFloat("2.5^2", 2.5^2, 6.25);
|
||||
|
||||
call assertEquals("round(2.3)", round(2.3), 2);
|
||||
call assertEquals("round(2.5)", round(2.5), 3);
|
||||
call assertEquals("round(2.7)", round(2.7), 3);
|
||||
call assertEquals("round(-2.3)", round(-2.3), -2);
|
||||
call assertEquals("round(-2.5)", round(-2.5), -3);
|
||||
call assertEquals("round(-2.7)", round(-2.7), -3);
|
||||
call assertEquals("round(0.0)", round(0.0), 0);
|
||||
call assertEquals("round(1.0)", round(1.0), 1);
|
||||
call assertEquals("round(<int>)", round(1), 1);
|
||||
|
||||
call assertFloat("sin(arctan(1, 1))", sin(arctan(1, 1)), 0.7071);
|
||||
call assertFloat("cos(arctan(1, 1))", cos(arctan(1, 1)), 0.7071);
|
||||
call assertFloat("log(ceil(2.7))", log(ceil(2.7)), 1.0986);
|
||||
call assertFloat("exponent(log(5))", exponent(log(5)), 5.0);
|
||||
|
||||
call report_test_results("math");
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
#include "sfall.h"
|
||||
|
||||
// this is the basic message_box function used by RPU and Et Tu
|
||||
#define message_box_warning(text) message_box4(text, 0x01, 134, 145)
|
||||
|
||||
procedure start begin
|
||||
// I don't see a practice way to auto test message_box, so this is just a way to do manual testing
|
||||
variable ret = message_box1("Basic Dialog\nwith multiple lines\nand such.");
|
||||
display_msg("chose: " + ret);
|
||||
message_box2("Basic Dialog\nwith default flags.", -1); // -1 means use default flags
|
||||
message_box2("Basic Dialog\nsmall.", 0x02);
|
||||
message_box_warning("Missing config values\n(just testing).");
|
||||
end
|
||||
@@ -0,0 +1,30 @@
|
||||
#include "test_utils.h"
|
||||
#include "sfall.h"
|
||||
|
||||
procedure start begin
|
||||
|
||||
display_msg("Testing metarule_exist functions...");
|
||||
|
||||
call assertEquals("string_format", metarule_exist("string_format"), 1);
|
||||
call assertEquals("metarule_exist", metarule_exist("metarule_exist"), 1);
|
||||
|
||||
// This will fail on sFall
|
||||
call assertEquals("opcode_exists", metarule_exist("opcode_exists"), 1);
|
||||
|
||||
if metarule_exist("opcode_exists") then begin // And example if how to use it
|
||||
#define opcode_exists(opcode) sfall_func1("opcode_exists", opcode)
|
||||
#define OP_GET_UPTIME 0x81B3
|
||||
#define OP_NOOP 0x8000
|
||||
#define OP_WRITE_INT 0x81D1
|
||||
|
||||
call assertEquals("opcode_exists OP_GET_UPTIME", opcode_exists(OP_GET_UPTIME), 1);
|
||||
call assertEquals("opcode_exists OP_NOOP", opcode_exists(OP_NOOP), 1);
|
||||
// Probably will never be implemented on fallout2-ce
|
||||
call assertEquals("opcode_exists OP_WRITE_INT", opcode_exists(OP_WRITE_INT), 0);
|
||||
call assertEquals("opcode_exists 0xFFFF", opcode_exists(0xFFFF), 0);
|
||||
end else begin
|
||||
display_msg("Opcode exists metarule is not available, skipping tests.");
|
||||
end
|
||||
|
||||
call report_test_results("metarule_exist");
|
||||
end
|
||||
@@ -0,0 +1,15 @@
|
||||
#include "test_utils.h"
|
||||
#include "sfall.h"
|
||||
|
||||
procedure start begin
|
||||
// TODO: move this to a more suitable place, once we have more functions implemented
|
||||
// These are in the "Other" category in the sfall documentation
|
||||
display_msg("Testing misc functions...");
|
||||
variable hand := active_hand;
|
||||
toggle_active_hand;
|
||||
call assertEquals("active_hand toggled", active_hand, 1 - hand);
|
||||
toggle_active_hand;
|
||||
call assertEquals("active_hand toggled", active_hand, hand);
|
||||
|
||||
call report_test_results("misc");
|
||||
end
|
||||
@@ -0,0 +1,82 @@
|
||||
#include "test_utils.h"
|
||||
#include "sfall.h"
|
||||
|
||||
#define REPEAT_64 "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
|
||||
#define REPEAT_512 REPEAT_64 REPEAT_64 REPEAT_64 REPEAT_64 REPEAT_64 REPEAT_64 REPEAT_64 REPEAT_64
|
||||
#define REPEAT_1024 REPEAT_512 REPEAT_512
|
||||
|
||||
procedure start begin
|
||||
|
||||
display_msg("Testing sprintf...");
|
||||
|
||||
call assertEquals("sprintf hello world", sprintf("Hello %s", "World"), "Hello World");
|
||||
|
||||
call assertEquals("sprintf empty string", sprintf("", 123), "");
|
||||
|
||||
call assertEquals("sprintf number string", sprintf("%d", 123), "123");
|
||||
|
||||
call assertEquals("sprintf number inside string", sprintf("Hello %d !", 123), "Hello 123 !");
|
||||
|
||||
call assertEquals("sprintf ascii code", sprintf("Hello %c !", 123), "Hello { !");
|
||||
|
||||
call assertEquals("sprintf float string", sprintf("Hello %f !", 3.4), "Hello 3.400000 !");
|
||||
|
||||
call assertEquals("sprintf float string", sprintf("Hello %d !", 10/4), "Hello 2 !");
|
||||
|
||||
call assertEquals("sprintf two strings", sprintf("Hello %s %s", "World"), "Hello World World");
|
||||
|
||||
call assertEquals("Long string", sprintf(REPEAT_1024"x", 1), "Error");
|
||||
|
||||
call assertEquals("Not so long", sprintf(REPEAT_1024, 1), REPEAT_1024);
|
||||
|
||||
|
||||
call assertEquals("string_format1 hello world", string_format1("Hello %s!", "World"), "Hello World!");
|
||||
call assertEquals("string_format1 auto hello world", string_format("Hello %s!", "World"), "Hello World!");
|
||||
|
||||
call assertEquals("string_format2 hello world", string_format2("Hello %s%s!", "Wo","rld"), "Hello World!");
|
||||
call assertEquals("string_format2 auto hello world", string_format("Hello %s%s!", "Wo","rld"), "Hello World!");
|
||||
|
||||
call assertEquals("string_format3 hello world", string_format3("Hell%s %s%s!", "o", "Wo","rld"), "Hello World!");
|
||||
call assertEquals("string_format3 auto hello world", string_format("Hell%s %s%s!", "o", "Wo","rld"), "Hello World!");
|
||||
|
||||
call assertEquals("string_format4 hello world", string_format4("Hel%s%s %s%s!", "l", "o", "Wo","rld"), "Hello World!");
|
||||
call assertEquals("string_format4 auto hello world", string_format("Hel%s%s %s%s!", "l", "o", "Wo","rld"), "Hello World!");
|
||||
|
||||
call assertEquals("string_format5 hello world", string_format5("He%s%s%s %s%s!", "l", "l", "o", "Wo","rld"), "Hello World!");
|
||||
call assertEquals("string_format5 auto hello world", string_format("He%s%s%s %s%s!", "l", "l", "o", "Wo","rld"), "Hello World!");
|
||||
|
||||
call assertEquals("string_format6 hello world", string_format6("H%s%s%s%s %s%s!", "e", "l", "l", "o", "Wo","rld"), "Hello World!");
|
||||
call assertEquals("string_format6 auto hello world", string_format("H%s%s%s%s %s%s!", "e", "l", "l", "o", "Wo","rld"), "Hello World!");
|
||||
|
||||
call assertEquals("string_format7 hello world", string_format7("%s%s%s%s%s %s%s!", "H", "e", "l", "l", "o", "Wo","rld"), "Hello World!");
|
||||
call assertEquals("string_format7 auto hello world", string_format("%s%s%s%s%s %s%s!", "H", "e", "l", "l", "o", "Wo","rld"), "Hello World!");
|
||||
|
||||
call assertEquals("formatted string length 1024", strlen(sprintf(REPEAT_1024, 1)), 1024);
|
||||
|
||||
call assertEquals("formatted string length 5119", strlen(
|
||||
string_format7(
|
||||
"%s%s%s%s%s%s%s",
|
||||
REPEAT_1024,
|
||||
REPEAT_1024,
|
||||
REPEAT_1024,
|
||||
REPEAT_1024,
|
||||
REPEAT_1024,
|
||||
REPEAT_1024,
|
||||
REPEAT_1024)), 5119);
|
||||
|
||||
call assertEquals("string_tolower", string_tolower("miXeD CaSe"), "mixed case");
|
||||
call assertEquals("string_toupper", string_toupper("miXeD CaSe"), "MIXED CASE");
|
||||
|
||||
call assertEquals("string_find ok", string_find("Hello World", "World"), 6);
|
||||
call assertEquals("string_find missing", string_find("Hello World", "Zebra"), -1);
|
||||
call assertEquals("string_find_from", string_find_from("Hello World", "o", 6), 7);
|
||||
|
||||
call assertEquals("string_compare ok", string_compare("Hello World", "HeLlO WoRld"), 1);
|
||||
call assertEquals("string_compare neq", string_compare("Hello World", "HeLlO WoRld!"), 0);
|
||||
call assertEquals("string_compare_locale", string_compare_locale("Hello World", "HeLlO WoRld", 866), 1); // TODO: would be nice to compare cyrillic
|
||||
|
||||
call assertEquals("charcode", charcode("A"), 65);
|
||||
call assertEquals("charcode empty", charcode(""), 0);
|
||||
|
||||
call report_test_results("sprintf");
|
||||
end
|
||||
@@ -0,0 +1,162 @@
|
||||
#include "define_lite.h"
|
||||
#include "sfall.h"
|
||||
#include "test_utils.h"
|
||||
#include "command_lite.h"
|
||||
|
||||
procedure test_stat_pc(variable stat_id) begin
|
||||
display_msg("Stat " + stat_id + " = " +
|
||||
get_pc_base_stat(stat_id) + " + " +
|
||||
get_pc_extra_stat(stat_id));
|
||||
|
||||
|
||||
call assertNotEquals("Not interesting stat, base stat is zero", get_pc_base_stat(stat_id), 0);
|
||||
|
||||
variable old_base_stat := get_pc_base_stat(stat_id);
|
||||
variable old_extra_stat := get_pc_extra_stat(stat_id);
|
||||
|
||||
set_pc_base_stat(stat_id, old_base_stat + 2);
|
||||
set_pc_extra_stat(stat_id, old_extra_stat + 4);
|
||||
// display_msg("Stat after update " + stat_id + " = " +
|
||||
// get_pc_base_stat(stat_id) + " + " +
|
||||
// get_pc_extra_stat(stat_id));
|
||||
if (stat_id > STAT_lu) then begin
|
||||
call assertNotEquals("Base stat was updated while it shouldn't",
|
||||
get_pc_base_stat(stat_id), old_base_stat + 2);
|
||||
end else begin
|
||||
call assertEquals("Base stat updated",
|
||||
get_pc_base_stat(stat_id), old_base_stat + 2);
|
||||
end
|
||||
|
||||
set_pc_base_stat(stat_id, old_base_stat);
|
||||
set_pc_extra_stat(stat_id, old_extra_stat);
|
||||
|
||||
// display_msg("Stat after reset " + stat_id + " = " +
|
||||
// get_pc_base_stat(stat_id) + " + " +
|
||||
// get_pc_extra_stat(stat_id));
|
||||
|
||||
call assertEquals("Base stat reset",
|
||||
get_pc_base_stat(stat_id), old_base_stat);
|
||||
|
||||
call assertEquals("Extra stat reset",
|
||||
get_pc_extra_stat(stat_id), old_extra_stat);
|
||||
end
|
||||
|
||||
procedure test_stat_critter(variable critter, variable stat_id) begin
|
||||
display_msg("Stat " + stat_id + " = " +
|
||||
get_critter_base_stat(critter, stat_id) + " + " +
|
||||
get_critter_extra_stat(critter, stat_id));
|
||||
|
||||
call assertNotEquals("Not interesting stat, base stat is zero",
|
||||
get_critter_base_stat(critter, stat_id), 0);
|
||||
|
||||
variable old_base_stat := get_critter_base_stat(critter, stat_id);
|
||||
variable old_extra_stat := get_critter_extra_stat(critter, stat_id);
|
||||
|
||||
set_critter_base_stat(critter, stat_id, old_base_stat + 2);
|
||||
set_critter_extra_stat(critter, stat_id, old_extra_stat + 4);
|
||||
// display_msg("Stat after update " + stat_id + " = " +
|
||||
// get_critter_base_stat(critter, stat_id) + " + " +
|
||||
// get_critter_extra_stat(critter, stat_id));
|
||||
if (stat_id > STAT_lu) then begin
|
||||
call assertNotEquals("Base stat was updated while it shouldn't",
|
||||
get_critter_base_stat(critter, stat_id), old_base_stat + 2);
|
||||
end else begin
|
||||
call assertEquals("Base stat updated",
|
||||
get_critter_base_stat(critter, stat_id), old_base_stat + 2);
|
||||
end
|
||||
|
||||
set_critter_base_stat(critter, stat_id, old_base_stat);
|
||||
set_critter_extra_stat(critter, stat_id, old_extra_stat);
|
||||
// display_msg("Stat after reset " + stat_id + " = " +
|
||||
// get_critter_base_stat(critter, stat_id) + " + " +
|
||||
// get_critter_extra_stat(critter, stat_id));
|
||||
call assertEquals("Base stat reset",
|
||||
get_critter_base_stat(critter, stat_id), old_base_stat);
|
||||
call assertEquals("Extra stat reset",
|
||||
get_critter_extra_stat(critter, stat_id), old_extra_stat);
|
||||
end
|
||||
|
||||
procedure test_derived_base_stat_critter(variable critter) begin
|
||||
display_msg("Testing derived stats on " + obj_name(critter));
|
||||
|
||||
variable old_agility;
|
||||
old_agility := get_critter_base_stat(critter, STAT_ag);
|
||||
|
||||
call assertNotEquals("Initial agility is 10", old_agility, 10);
|
||||
|
||||
call assertNotEquals("Action points is 10 while agility is not 10", get_critter_base_stat(critter, STAT_max_move_points), 10);
|
||||
|
||||
set_critter_base_stat(critter, STAT_ag, 10);
|
||||
|
||||
call assertEquals("Action points updated to 10",
|
||||
get_critter_base_stat(critter, STAT_max_move_points), 10);
|
||||
|
||||
set_critter_base_stat(critter, STAT_ag, old_agility);
|
||||
|
||||
call assertNotEquals("Action points updated from 10",
|
||||
get_critter_base_stat(critter, STAT_max_move_points), 10);
|
||||
|
||||
end
|
||||
|
||||
procedure start begin
|
||||
display_msg("Testing stats...");
|
||||
test_suite_errors := 0;
|
||||
|
||||
call test_stat_pc(STAT_max_hit_points);
|
||||
|
||||
call test_stat_pc(STAT_lu);
|
||||
|
||||
|
||||
variable critter;
|
||||
variable closest_critter := dude_obj;
|
||||
foreach critter in list_as_array(LIST_CRITTERS) begin
|
||||
if (is_critter_dead(critter)) then begin
|
||||
continue;
|
||||
end
|
||||
if tile_distance(dude_tile, tile_num(critter)) == 0 then begin
|
||||
continue;
|
||||
end
|
||||
if (tile_distance(dude_tile, tile_num(critter)) <
|
||||
tile_distance(dude_tile, tile_num(closest_critter))) or
|
||||
(closest_critter == dude_obj)
|
||||
then begin
|
||||
closest_critter := critter;
|
||||
end
|
||||
end
|
||||
|
||||
// display_msg("Closest " + obj_name(closest_critter) + " distance: " +
|
||||
// tile_distance(dude_tile, tile_num(closest_critter)));
|
||||
|
||||
call test_stat_critter(dude_obj, STAT_max_hit_points);
|
||||
call test_stat_critter(dude_obj, STAT_lu);
|
||||
|
||||
if closest_critter != dude_obj then begin
|
||||
display_msg("Testing stats for " + obj_name(closest_critter));
|
||||
call test_stat_critter(closest_critter, STAT_max_hit_points);
|
||||
call test_stat_critter(closest_critter, STAT_lu);
|
||||
end else begin
|
||||
display_msg("FAIL: No other critters found to test stats");
|
||||
test_suite_errors++;
|
||||
end
|
||||
|
||||
|
||||
if
|
||||
get_critter_base_stat(dude_obj, STAT_lu) ==
|
||||
get_critter_base_stat(closest_critter, STAT_lu)
|
||||
and
|
||||
get_critter_extra_stat(dude_obj, STAT_max_hit_points) ==
|
||||
get_critter_extra_stat(closest_critter, STAT_max_hit_points) then begin
|
||||
display_msg("FAIL: Very sus eq values for dude and closest critter");
|
||||
test_suite_errors++;
|
||||
end
|
||||
|
||||
|
||||
call test_derived_base_stat_critter(dude_obj);
|
||||
call test_derived_base_stat_critter(closest_critter);
|
||||
|
||||
call report_test_results("stats");
|
||||
|
||||
|
||||
// set_pc_base_stat(STAT_lu, 10);
|
||||
// set_pc_extra_stat(STAT_max_hit_points, 500);
|
||||
end
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "sfall.h"
|
||||
|
||||
procedure start begin
|
||||
// this isn't a unit test, just a way to easily test different values manually
|
||||
display_msg("Setting world map mult");
|
||||
set_map_time_multi(1.0);
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
[ValidSection]
|
||||
Key1=Value1
|
||||
Key2=2
|
||||
|
||||
[SectionWithSpaces]
|
||||
LeadingSpaceKey = LeadingSpaceValue
|
||||
TrailingSpaceKey = TrailingSpaceValue
|
||||
Both Sides Space Key = Both Sides Space Value
|
||||
SimpleKey=SimpleValue
|
||||
|
||||
[EmptySection]
|
||||
|
||||
; This is TestMisc, it's not empty but won't be directly tested for content here.
|
||||
[TestMisc]
|
||||
Alpha=Beta
|
||||
Gamma=Delta
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user