Compare commits

..
Author SHA1 Message Date
google-labs-jules[bot] 6c42bb2630 Here's the rewritten message:
Add opcodes for getting world map position

I've implemented `get_world_map_x_pos` (0x8173) and `get_world_map_y_pos` (0x8174) sfall opcodes. These functions allow your scripts to retrieve the player's current X and Y coordinates on the world map.

The implementation mirrors the existing `set_world_map_pos` functionality by calling the underlying `wmGetPartyWorldPos` engine function.

I've added a new test script `sfall_testing/gl_test_worldmap.ssl` which includes cases for:
- Basic retrieval of X and Y coordinates.
- Retrieval after multiple position sets.
- Retrieval of zero coordinates.
- Retrieval of negative coordinates (assuming engine support).

Note: I wasn't able to automatically register the new test script in CMakeLists.txt as the specified variable was not found. I also encountered an issue that prevented me from verifying the test execution.
2025-06-09 06:26:28 +00:00
Vasilii Rogin 7767aabdce Merge pull request #197 from fallout2-ce/change_stencil_option
Change high resolution stencil option
2025-06-08 09:46:34 +03:00
Vasilii Rogin 9cb2b83db1 Merge pull request #185 from fallout2-ce/improve_tests_report
Use global variables and arrays to show tests summary
2025-06-07 20:45:11 +03:00
Vasilii Rogin 75ca12e07c Improve tests reporting 2025-06-07 19:06:48 +03:00
Vasilii Rogin f85e8ba67b Use lowercase for test results 2025-06-07 18:54:56 +03:00
Vasilii Rogin 07876ddaf9 Use arrays for sharing data between tests 2025-06-07 18:51:56 +03:00
Vasilii Rogin 7288f8eeb7 Merge remote-tracking branch 'fallout2-ce/main' into improve_tests_report 2025-06-07 18:27:45 +03:00
Vasilii Rogin 1a46d0f59f Make EnableHighResolutionStencil enabled by default in proper place 2025-06-07 17:40:11 +03:00
Vasilii Rogin 7c2dfa9af1 Change HiResMode into EnableHighResolutionStencil 2025-06-07 17:38:12 +03:00
Vasilii Rogin d681e7be69 Merge pull request #192 from fallout2-ce/toggle-active-hand
Add `toggle_active_hand` (sfall)
2025-06-07 12:23:06 +03:00
Mike Klaas 8294e15d3c Default to 800px interface bar (#181)
(still can be overriden by config)

Will fall back to 640px version if screen is narrower than 800px or asset doesn't exist
2025-06-06 21:07:11 -07:00
Mike Klaas 4278d1a1d0 fix crash 2025-06-06 20:54:24 -07:00
Mike Klaas b2675ad1ac Add toggle_active_hand (sfall) 2025-06-06 00:34:36 -07:00
Vasilii Rogin 5dafa019c9 Merge pull request #190 from fallout2-ce/all-opcodes
Reformat sfall opcode list to contain all opcodes
2025-06-03 20:10:25 +03:00
Mike Klaas 8888fc46d6 Reformat sfall opcode list to contain all opcodes
This pulls in every sfall opcode, including param types and returnval.  It is grouped in a more "natural" order (i.e. what the sfall doc lists) instead of numeric order, which helps see which opcodes from a logical group are missing
2025-06-03 08:56:16 -07:00
Mike Klaas 001bdbee5c Add all remaining sfall math functions (#187)
* Add all remaining sfall math functions

* Fix op_round
2025-06-03 08:06:29 -07:00
Vasilii Rogin 40471e5a0b Merge pull request #186 from fallout2-ce/experiment_with_gh-pages_cleanup
Add single-commit option for preview deployments
2025-06-02 21:00:24 +03:00
Vasilii Rogin ad776876a1 Add check that it is gh-pages branch 2025-06-02 20:53:30 +03:00
Vasilii Rogin 224f1088f2 Also force-push to gh-pages on PR cleanup 2025-06-02 20:52:46 +03:00
Vasilii Rogin 05b692f403 Add single-commit option for preview deployments 2025-06-02 20:43:56 +03:00
Vasilii Rogin 190906bb5f Use global variables to show tests summary 2025-06-02 18:31:40 +03:00
Mike Klaasandgithub-actions[bot] 41dd2ccd81 Implement all remaining sfall string functions (#184)
Implement string_to_case, and add comments for missing metarules/opcodes
    string_find
    string_compare
    charcode

This should complete all string functions listed here that aren't deprecated.


* chore: auto-format with clang-format

* PR feedback

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-02 10:12:25 +03:00
Vasilii Rogin 04e93cabd7 Merge pull request #183 from fallout2-ce/add_sprintf
Add sprintf, add test utils
2025-06-01 20:03:04 +03:00
Vasilii Rogin a31af0671d Use .h for test utils 2025-06-01 19:54:25 +03:00
Vasilii Rogin 72df28f53a Use const to reduce warnings 2025-06-01 17:07:13 +03:00
github-actions[bot] 7e3bd36f86 chore: auto-format with clang-format 2025-06-01 14:03:26 +00:00
Vasilii Rogin 94ce0fbe11 Merge remote-tracking branch 'fallout2-ce/main' into add_sprintf 2025-06-01 17:01:28 +03:00
Vasilii Rogin a368f27ad4 Add one more byte to be safe 2025-06-01 16:56:12 +03:00
Vasilii Rogin d8d411e847 Add test for big strings 2025-06-01 16:53:29 +03:00
Vasilii Rogin 5eef9af7a9 Add one more test 2025-06-01 16:46:20 +03:00
Vasilii Rogin 0419efad8f Add sprintf 2025-06-01 16:42:42 +03:00
Vasilii Rogin 21f432afbb Register opcode 2025-06-01 16:13:37 +03:00
Vasilii Rogin aed05c0daf Initial implemenation of sprintf 2025-06-01 16:10:12 +03:00
Vasilii Rogin 8a8b54d4b7 Increase metarules params to 8 2025-06-01 15:30:13 +03:00
Vasilii Rogin 8ee543ec16 Add tests for metarules with multiple params 2025-06-01 15:27:42 +03:00
Vasilii Rogin 161bb82f30 Slightly better output for tests 2025-06-01 14:08:18 +03:00
Vasilii Rogin 22bd1ffbba Small cleanup in tests 2025-06-01 13:57:29 +03:00
Vasilii Rogin f46f1c78d4 Add test for string_format 2025-06-01 13:15:58 +03:00
Vasilii Rogin 3d0e206825 Add tests for float 2025-06-01 13:01:14 +03:00
Vasilii Rogin 47a9891e0e Add test for %c 2025-06-01 12:58:51 +03:00
Vasilii Rogin f1e5cde84f Add tests for sprintf 2025-06-01 12:56:45 +03:00
Vasilii Rogin 015909fdef Use lowercase for scripts 2025-06-01 12:47:30 +03:00
Vasilii Rogin 1e91b401f1 Fix stats test 2025-06-01 12:31:23 +03:00
Vasilii Rogin 29a0be50f4 Update stats test 2025-06-01 12:28:23 +03:00
Vasilii Rogin 9e3ce4cd8d Fix stats test 2025-06-01 12:22:33 +03:00
Vasilii Rogin 592882b7b8 Adding tests 2025-06-01 12:18:12 +03:00
Vasilii Rogin cbd7b45736 Merge pull request #182 from fallout2-ce/add_test_script_for_sfall_opcodes
Add test for derived stats
2025-06-01 10:47:45 +03:00
Vasilii Rogin 220fb8e190 Add test for derived stats 2025-06-01 10:39:43 +03:00
Vasilii Rogin 5a29fc1815 Merge pull request #180 from fallout2-ce/make-sfall-opcodes-consistent
Rename sfall opcodes to use underscores for consistency.
2025-06-01 09:36:53 +03:00
Mike Klaas a083779fb2 Rename sfall opcodes to use underscores for consistency.
This also makes them significantly easier to find in the codebase
2025-05-31 14:11:32 -07:00
Vasilii Rogin 95d254cd45 Merge pull request #179 from fallout2-ce/add_test_script_for_sfall_opcodes
Add critter stats opcodes
2025-05-31 23:32:22 +03:00
Vasilii Rogin 0d8f4cc711 Merge branch 'main' into add_test_script_for_sfall_opcodes 2025-05-31 23:11:27 +03:00
Vasilii Rogin aabc971dd5 Merge pull request #176 from fallout2-ce/update_windows_runner
Update windows runner
2025-05-31 23:11:06 +03:00
Vasilii Rogin b069e3b941 Update testing script 2025-05-31 20:06:25 +03:00
Vasilii Rogin 823f72492f Implement critter stat opcodes 2025-05-31 20:06:16 +03:00
Vasilii Rogin e5f3734e08 Add opcodes 2025-05-31 19:57:52 +03:00
Vasilii Rogin e37522d388 Add test for critter stats set/get 2025-05-31 19:51:37 +03:00
Vasilii Rogin 07a361f63a Add float_msg 2025-05-31 19:32:01 +03:00
Vasilii Rogin 515bec4c82 Adding simple test for stats 2025-05-31 18:34:56 +03:00
Vasilii Rogin 42bfdc7343 Update testing docs to use global scripts 2025-05-31 16:57:51 +03:00
Vasilii Rogin 0fd5e59575 Remove choco cache because it does not work properly 2025-05-31 15:01:02 +03:00
Vasilii Rogin 0d0578f111 Revert "Add --force flag to re-install in case of used cache"
This reverts commit dacda99b98.
2025-05-31 14:59:33 +03:00
Vasilii Rogin dacda99b98 Add --force flag to re-install in case of used cache 2025-05-31 14:56:39 +03:00
Vasilii Rogin dfb0463b02 Add arch into choco cache 2025-05-31 14:34:53 +03:00
Vasilii Rogin 1903e04c6e Update release workflow too 2025-05-31 14:25:49 +03:00
Vasilii Rogin abec3681b0 Use win2025 with vs2019 2025-05-31 14:14:18 +03:00
cambragol 5a9f8fb46c Merge pull request #164 from fallout2-ce/character-screen-button-fix
Character Screen Button Fix
2025-05-31 10:03:03 +09:00
cambragol 3659c834ae Merge pull request #166 from fallout2-ce/animations-behind-worldmap-fix
Animations behind worldmap fix
2025-05-31 09:54:19 +09:00
Mike Klaas 196553ec46 Don't crash if game resolution is <800 with custom interface bar (#174)
* Don't crash if game resolution is <800 with custom interface bar
2025-05-29 22:52:26 -07:00
Mike Klaas 57f1229a51 Add click when using a to Take all or move All (#169)
Most other button make a sound when you use the keyboard shortcut, and so ought these
2025-05-29 15:22:34 -07:00
Mike Klaasandgithub-actions[bot] 413c843ff5 Fix bug that stopped music when reloading on the same map (#168)
* Fix bug that stopped music when reloading on the same map

If you have GaplessMusic=1 and load a saved game on the same map you're currently on, we erroneously skip playing music.  This fixes that problem.

Also, still playing loading sound if no background music is playing (not sure there can actually happen).  I still want to get the loading sound back in eventually.

Finally, added a bit of decyption.  It's not complete yet but has some deciphering

* chore: auto-format with clang-format

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-29 00:21:29 -07:00
cambragol 995102d515 Update worldmap.h
removed unneeded global
2025-05-29 16:08:38 +09:00
cambragol dd867446ea Update worldmap.cc
removed unneeded global
2025-05-29 16:07:48 +09:00
cambragol 4f91e38cc0 Update animation.cc 2025-05-29 16:05:53 +09:00
cambragol 016c83bc48 Inventory Item not Disappearing Fix (#161)
Fixes #160 

Conditional was incorrect.
2025-05-28 21:58:23 -07:00
cambragol d8dc05597b Update worldmap.cc
Fixed placement of  inWorldMap = true; and inWorldMap = false; Was preventing animations outside of worldmp.
2025-05-27 19:49:44 +09:00
github-actions[bot] 7d9e1612c6 chore: auto-format with clang-format 2025-05-27 08:42:47 +00:00
cambragol 848bd97e42 Update animation.cc
Check for 'isWorldMapActive', so we know to turn off fidget animation behind the map.
2025-05-27 17:39:08 +09:00
cambragol 5c5512277d Update worldmap.cc
Adding global for inWorldMap - so we know if the world map is active or not.
2025-05-27 17:37:22 +09:00
cambragol 016f853c0a Update worldmap.h
Adding a bool for 'inWorldMap' to fix animations behind worldmap
2025-05-27 17:32:01 +09:00
cambragol 9edbf0dd72 Update character_editor.cc
Adjusted the correct button x coordinates. Previously had adjusted the x coordinates of the button labels.
2025-05-27 14:25:28 +09:00
cambragol 36af4b2ea8 Update character_editor.cc
Moved 3 bottom buttons 1 pixel to right. Affects both screens, and aligns them better to the baked in buttons.
2025-05-26 21:33:45 +09:00
Vasilii Rogin 145cf6bbcc Merge pull request #157 from fallout2-ce/deobfus-window-2
More deobfuscation in `window.cc,h`
2025-05-25 08:59:40 +03:00
Mike Klaas 5b39307f61 More deobfuscation in window.cc,h
As usualy, no logic changes
2025-05-24 22:45:21 -07:00
Vasilii Rogin 547cabc42d Merge pull request #153 from roginvs/auto-fix-formatting-on-main-branch
Auto fix formatting on main branch or PR branch
2025-05-24 17:34:47 +03:00
Vasilii Rogin d2a3d61dcb Trying auto-format 2025-05-24 14:16:53 +03:00
Vasilii Rogin 2d1966f0af Adding manual workflow 2025-05-24 13:56:48 +03:00
Vasilii Rogin a406c5f019 CI fixes 2025-05-24 13:43:31 +03:00
Vasilii Rogin 9ca540f05e Auto-format only PRs from the same repo 2025-05-24 13:32:12 +03:00
Vasilii Rogin 4678e19edd Add formatter for PR too 2025-05-24 13:31:06 +03:00
Vasilii Rogin 485d2253f4 Add auto-formatting workflow 2025-05-24 13:29:16 +03:00
Mike Klaas 72309fc9dc Deobfuscate some parameters in window.h,cc (#152)
Note: no logic changes

Removed a parameter which was never used
2025-05-23 23:45:05 -07:00
cambragol fda6fd0646 Update game_dialog.cc (#139)
* Update game_dialog.cc

* Update game_dialog.cc

* Update game_dialog.cc
2025-05-23 21:24:59 -07:00
Mike Klaas 2126e23161 QoL: Add Ctrl-click to move items in inventory, barter, looting/stealing (#133)
* Add Ctrl-click to move items in inventory, barter, looting/stealing

Barter: move from table (offer) to inventory, on both merchant and pc.
Looting/stealing: move from one side to the other.
Inventory: ctrl-click to unequip armor or item in hand.

Modeled after the SFALL feature.

* skip quantity selection when quick moving

* Add `a` to inventory quantity select screen as a quick way to select ALL

* format

* Add Readme changes, and `a` to `Take All`

* try to format

* fmt
2025-05-24 13:06:41 +09:00
Vasilii Rogin 0fa90a1a00 Merge pull request #140 from fallout2-ce/add_test_script_for_sfall_opcodes
Add test script for sFall opcodes
2025-05-23 22:43:21 +03:00
Vasilii Rogin 9bfc3e83cd Add fix_formatting script 2025-05-23 22:34:41 +03:00
Vasilii Rogin 2f974aefed Fix formatting 2025-05-23 22:29:47 +03:00
Vasilii Rogin b27093b7ac Merge remote-tracking branch 'fallout2-ce/main' into add_test_script_for_sfall_opcodes 2025-05-23 22:29:26 +03:00
Vasilii Rogin 6f240acf0a Fix typo 2025-05-23 21:35:20 +03:00
cambragol 5dbcfd997c Fixes slightly misaligned buttons in the pipboy (#147) 2025-05-22 23:17:07 -07:00
cambragol 88205ded62 Merge pull request #129 from fallout2-ce/Locations-Scroll-Menu
Update worldmap.cc
2025-05-20 20:40:37 +09:00
Vasilii Rogin a3d37e11c1 Update README 2025-05-18 22:49:32 +03:00
Vasilii Rogin 0e18e77901 Fix formatting 2025-05-18 18:43:07 +03:00
Vasilii Rogin 9d2db5b36a Remove note 2025-05-18 16:17:25 +03:00
Vasilii Rogin b88230426d Update README 2025-05-18 16:14:40 +03:00
Vasilii Rogin bbf52f6b2d Add testing information 2025-05-18 15:51:25 +03:00
Vasilii Rogin 89a9d1ae12 Add initial version of test scripts 2025-05-18 15:15:28 +03:00
cambragol 3216fd02b0 Merge pull request #90 from fallout2-ce/cambragol-patch-3
Update game_dialog.cc to fix Combat Control buttons/sounds
2025-05-18 16:20:59 +09:00
cambragol b4ea465acb Merge pull request #135 from fallout2-ce/default-hires
Turn on hires stencils by default
2025-05-18 10:26:56 +09:00
Mike Klaas 6178149b07 Turn on hires stencils by default
I can't think of a reason why someone would want to do hires without the stencils.  Nevertheless it's still turn off-able using `HiResMode=0` if desired.

In addition, updated the Readme to not mention it (since only very few people would care about turning it off), and fixed the link to the sample ddraw.ini
2025-05-17 16:20:37 -07:00
Mike Klaas 942d88476a Update inventory.cc to fix button click sounds for 'Move Items'
Update inventory.cc to fix button click sounds for 'Move Items'
2025-05-17 16:02:56 -07:00
cambragol b72808a0d3 Update inventory.cc
removed erroneous click sound
2025-05-16 15:44:54 +09:00
cambragol 43fdd520cd Merge pull request #127 from fallout2-ce/mainmenu
Readme adjustments
2025-05-15 20:05:29 +09:00
cambragolandMike Klaas 004eb67b1f Apply suggestions from code review
Co-authored-by: Mike Klaas <mike.klaas@gmail.com>
2025-05-15 14:40:44 +09:00
cambragol 3cdd477df8 Update worldmap.cc
Reduced scrolling from 7! lines at a time, to 1. This also makes mouse scrolling actually work as it should as well.
2025-05-14 20:47:08 +09:00
cambragol aa96478d69 Update ddraw.ini
Settings: commented out or set to zero/Fallout 2
2025-05-14 16:02:47 +09:00
cambragol 683091b456 Update README.md 2025-05-13 17:41:42 +09:00
cambragol c2c5a1c80a Update f2_res.ini 2025-05-13 17:23:04 +09:00
cambragol 1aeca09c39 Delete files/test.rtf 2025-05-13 17:12:28 +09:00
cambragol 0bbb594511 Add files via upload 2025-05-13 17:11:39 +09:00
cambragol 822a3d9bd4 Create test.rtf
trying to add/make a folder.
2025-05-13 17:07:46 +09:00
Vasilii Rogin 8416008b0f Merge branch 'main' into cambragol-patch-3 2025-05-04 16:08:48 +03:00
cambragol 25fbb8e5c3 Update game_dialog.cc
Forgot to set the button code
2025-05-02 14:48:35 +09:00
cambragol ca9eaf16a9 Update game_dialog.cc
fixed small red button clicks to use proper format - now give click on press, and release. Return gives click, and Cancel does not (standard behavior)
2025-05-02 07:09:41 +09:00
cambragol a1237ee387 Update inventory.cc
small fix
2025-05-01 20:00:53 +09:00
cambragol d7a5c64cdb Update inventory.cc
fixing borked submit
2025-05-01 19:44:54 +09:00
cambragol 313991b1d4 Update inventory.cc
New approach, following the pattern found elsewhere in the code.
Cancel has no sound effect when using ESC (as found elsewhere)
2025-05-01 19:38:26 +09:00
cambragol 20e3810b9b Update game_dialog.cc
Forgot one function to exit (lock) frms

This fixes #94
2025-04-29 21:02:52 +09:00
cambragol 33dae201fe Update game_dialog.cc
Small updates fixes button layering with background - fixes #93
2025-04-29 13:07:49 +09:00
cambragol 62108938f5 Update game_dialog.cc to fix using keyboard
Fixed to make buttons work when clicked, or when using key commands.

This makes an imperfect button sound (misses the click release), however, the game is littered with this compromise.

Fixes #90
2025-04-28 23:08:01 +09:00
cambragol 6c13d67921 Update inventory.cc to fix button click sounds for 'Move Items'
Fixed to make buttons work when clicked, or when using key commands.

This makes an imperfect button sound (misses the click release), however, the game is littered with this compromise.

Fixs #88
2025-04-28 23:06:05 +09:00
cambragol aa7bda09d8 Update game_dialog.cc to fix Combat Control buttons/sounds
Fixes everything in #89
2025-04-28 22:11:40 +09:00
46 changed files with 2374 additions and 468 deletions
+42
View File
@@ -0,0 +1,42 @@
name: Auto Format with Clang
on:
pull_request:
types: [opened, synchronize]
push:
branches: [main]
jobs:
format:
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || github.ref_name }}
token: ${{ secrets.PAT_FOR_ACTIONS }}
- name: Run clang-format via Docker
run: |
docker run --rm \
-v ${{ github.workspace }}:/app --workdir /app \
--user $(id -u):$(id -g) silkeh/clang:18 \
bash -c 'find src -type f \( -name "*.cc" -o -name "*.h" \) -print0 | xargs -0 clang-format -i'
# https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-to-a-pr-using-the-built-in-token
- name: Check and commit changes if needed
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if ! git diff --quiet; then
git diff
git commit -am "chore: auto-format with clang-format"
git push
else
echo "No formatting changes"
fi
+1
View File
@@ -89,6 +89,7 @@ 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
+13 -4
View File
@@ -313,7 +313,7 @@ jobs:
windows:
name: Windows (${{ matrix.arch }})
runs-on: windows-2019
runs-on: windows-2025
strategy:
fail-fast: false
@@ -328,19 +328,28 @@ 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:
path: out
key: windows-${{ matrix.arch }}-cmake-v2
key: windows-${{ matrix.arch }}-cmake-v3
- 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 }}-release
- name: Change executable file name
run: |
+15 -2
View File
@@ -29,5 +29,18 @@ 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
+12 -10
View File
@@ -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: |
+40 -9
View File
@@ -96,17 +96,36 @@ The main configuration file is `fallout2.cfg`. There are several important setti
The `sound` folder (with `music` folder inside) might be located either in `data` folder, or be in the Fallout folder. Update `music_path1` setting to match your hierarchy, usually it's `data/sound/music/` or `sound/music/`. Make sure it matches your path exactly (so it might be `SOUND/MUSIC/` if you've installed Fallout from CD). Music files themselves (with `ACM` extension) should be all uppercased, regardless of `sound` and `music` folders.
The second configuration file is `f2_res.ini`. Use it to change game window size and enable/disable fullscreen mode.
The second configuration file is `f2_res.ini`. Use it to change game window size, enable/disable fullscreen mode and configure IFACE settings (the control bar at the bottom of the game screen).
```ini
[MAIN]
SCR_WIDTH=1280
SCR_HEIGHT=720
WINDOWED=1 ; 0 = fullscreen
SCALE_2X=1 ; 0 = original scale, 1 = 2x
SCALE_2X=1 ; 0 = original scale, 1 = 2x - requires increasing the minimum resolution from 640x480 to 1280x960.
[IFACE]
IFACE_BAR_MODE, IFACE_BAR_SIDE_ART, IFACE_BAR_SIDES_ORI, IFACE_BAR_WIDTH supported (require assets in appropriate places)
; if IFACE_BAR_MODE=0 - the bottom of the map view window sits at the top of the IFACE Bar.
; if IFACE_BAR_MODE=1 - the bottom of the map view window extends to the base of the screen and is overlapped by the IFACE Bar.
IFACE_BAR_MODE=0
;if IFACE_BAR_SIDE_ART=0 - Black, No Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=1 - Metal (grey) look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=2 - Leather look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=3-6 - Alternative Metal look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=7 - Alternative Leather look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=8 - Metal (brown) look Iface-bar side art used.
IFACE_BAR_SIDE_ART=2
;if IFACE_BAR_SIDES_ORI=0 - Iface-bar side graphics extend from the Iface-Bar to the Screen edges.
;if IFACE_BAR_SIDES_ORI=1 - Iface-bar side graphics extend from the Screen edges to the Iface-Bar.
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
```
Recommendations:
@@ -114,18 +133,30 @@ Recommendations:
- **Tablets**: Set these values to logical resolution of your device, for example iPad Pro 11 is 1668x2388 (pixels), but it's logical resolution is 834x1194 (points).
- **Mobile phones**: Set height to 480, calculate width according to your device screen (aspect) ratio, for example Samsung S21 is 20:9 device, so the width should be 480 * 20 / 9 = 1067.
In time this stuff will receive in-game interface, right now you have to do it manually.
In time this stuff will receive in-game interface, right now you have to do it manually. For a sample f2_res.ini configuration file, containing all currently working settings use this link: [f2_res.ini](https://raw.githubusercontent.com/fallout2-ce/fallout2-ce/refs/heads/mainmenu/files/f2_res.ini)
The third configuration file is `ddraw.ini` (part of Sfall). There are dozens of options that adjust or override engine behaviour and gameplay mechanics. This file is intended for modders and advanced users. Currently only a small subset of these settings are actually implemented. For high res configs, the following is recommended:
```[Main]
HiResMode=1
```
*Note*: use of the IFACE_BAR settings requires the f2_res.dat file, which contains graphical assets. Various versions are available, but one compatible with the above f2_res.ini be found here: [f2_res.dat](https://github.com/fallout2-ce/fallout2-ce/raw/refs/heads/mainmenu/files/f2_res.dat)
The third configuration file is `ddraw.ini` (part of Sfall). There are dozens of options that adjust or override engine behaviour and gameplay mechanics. This file is intended for modders and advanced users.
For a sample ddraw.ini configuration file, containing all currently working settings use this link: [ddraw.ini](https://raw.githubusercontent.com/fallout2-ce/fallout2-ce/refs/heads/main/files/ddraw.ini)
## Quality of life benefits over vanilla Fallout
* High resolution support
* Increased pathfinding nodes 5x for more accurate pathfinding
* Ctrl-click to quickly move items when bartering, looting, or stealing
* _a_ to select "all" when selecting item quantity
* _a_ to `Take All` when looting
* When bartering, caps default to the right amount to balance the trade (if possible)
* Music continues playing between maps (requires config)
* Auto open doors (requires config)
## Contributing
Integrating Sfall goodies is the top priority. Quality of life updates are OK too. Please no large scale refactorings at this time as we need to reconcile changes from Reference Edition, which will make this process slow and error-prone. In any case open up an issue with your suggestion or to notify other people that something is being worked on.
### Intergrating Sfall
### Integrating Sfall
There are literally hundreds if not thousands of fixes and features in sfall. I guess not all of them are needed in Community Edition, but for the sake of compatibility with big mods out there, let's integrate them all.
+208
View File
@@ -0,0 +1,208 @@
;sfall configuration settings for Fallout 2 CE
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Main]
;Set to one to hide areas outside map bounds when using higher than 640x480 resolution, and to zero to disable
;EnableHighResolutionStencil=1
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Misc]
;Uncomment these lines to change the timers of how many days after the game starts Hakunin dream sequences will occur
;MovieTimer_artimer1=5000
;MovieTimer_artimer2=5000
;MovieTimer_artimer3=5000
;MovieTimer_artimer4=5000
;To start a new game somewhere other than artemple.map, uncomment the next line and set it to the map you want to load
;StartingMap=V13ent.map
;To change the 'FALLOUT II v1.02d' version string on the main menu, uncomment the next line
;You can use up to 2 %d's in this if you want to include Fallout's version number somewhere
;VersionString=FALLOUT II v1.02d
;To use a config file other than fallout2.cfg, uncomment the next line and add the name of your new file
;ConfigFile=
;To use a patch file other than patch000.dat, uncomment the next line and add your new file name
;If you want to load multiple patch files (up to 1000) at once, you can include a %d in the file name (sprintf syntax)
;PatchFile=patch%03d.dat
;Set to 1 to allow using the caret character '^' in dialog msg files to specify alternative text in dialogue based on the player's gender
;The text must be enclosed in angle brackets (example: <MaleText^FemaleText>)
;DialogGenderWords=0
;To change the default and starting player models, uncomment the next four lines.
;The default models can also be changed in-game via script
;MaleStartModel=hmjmps
;MaleDefaultModel=hmjmps
;FemaleStartModel=hfjmps
;FemaleDefaultModel=hfjmps
;To change the starting year, month or day, uncomment the next 3 lines
;Both StartMonth and StartDay are 0-indexed (i.e. 0 is January or the first day of a month)
;StartYear=2241
;StartMonth=01
;StartDay=01
;Set to 1 if you want the pipboy to be available at the start of the game
;Set to 2 to make the pipboy available by only skipping the vault suit movie check
;PipBoyAvailableAtGameStart=1
;Choose the damage formula used to calculate combat damage.
;Don't set this to anything other than 0 unless another mod you're using explicitly tells you to!
;0 - Fallout default
;1 - Glovz's Damage Fix
;2 - Glovz's Damage Fix with Damage Multiplier tweak
;5 - Haenlomal's Yet Another Ammo Mod
;DamageFormula=0
;Prevents you from using 0 to escape from dialogue at any time.
;DialogueFix=1
;Prevents you from using number keys to enter unvisited areas on a town map
TownMapHotkeysFix=1
;Set to 1 to use a CriticalOverrides.ini file to override the default critical table
;Set to 2 to use the default critical with bug fixes (doesn't require an ini)
;Set to 3 to use a new format CriticalOverrides.ini file, with preadded bug fixes
;If the ExtraKillTypes option is enabled, this should be set to 3, with containing entries for any new types
;Must be non-zero to use the edit/get/reset_critical script functions
;OverrideCriticalTable=2
;Set to 1 to get notification of karma changes in the notification window
DisplayKarmaChanges=0
;Set to 1 to skip the 3 opening movies
;Set to 2 to also skip the splash screen
SkipOpeningMovies=0
;Change the Skilldex cursor FRM numbers
;Default is 293 for all skills
Lockpick=293
Steal=293
Traps=293
FirstAid=293
Doctor=293
Science=293
Repair=293
;Uncomment these lines to control the premade characters offered when starting a new game
;Multiple options should be separated by commas, and there must be the same number of entries in both lines
;Each name in PremadePaths is limited to 11 characters
;PremadePaths=combat,diplomat,stealth
;PremadeFIDs=201,203,202
;Use this line to modify the list of cities and their associated global variables used for city reputations
;Syntax is 'city id:global id', with each city/global pair separated by a comma.
;CityRepsList=0:5001,2:5003,3:5004,4:5005,5:5006,6:5007,7:5008,8:5009,10:5011,11:5012,60:1640
;Set this to a valid path to save a copy of the console contents
;ConsoleOutputPath=console.txt
;Set to 1 to add additional pages of save slots !!! can be implemented !!!
;ExtraSaveSlots=1
;To use more than one save slot for quick saving (F6 key) without picking a slot beforehand, set the next two lines
;Quick save will cyclically overwrite saves from the first slot on the specified page to the last slot on the n-th page
;AutoQuickSave sets how many pages you want to use for quick saving (valid range: 1..10)
;Set to 0 to disable
AutoQuickSave=0
;These lines allow you to control the karma FRMs displayed on the character screen
;Number of KarmaPoints should be 1 less than number of KarmaFRMs
;KarmaFRMs=47,48,49
;KarmaPoints=-100,100
;Set to 1 to allow science and repair to be used on the player, or 2 for all critters. (Rather than only brahmin/robots)
ScienceOnCritters=0
;Set to 1 to fix the bug that caused bonus HtH damage to not be applied correctly.
BonusHtHDamageFix=1
;Set to 1 to display additional points of damage from Bonus HtH/Ranged Damage perks in the inventory
;DisplayBonusDamage=1
;Set to 1 to remove the limits that stop the game from rolling critical successes/failures in the first few days of game time
RemoveCriticalTimelimits=0
;Change the colour of the font used on the main menu for the Fallout/sfall version string and copyright text
;It's the last byte ('3C' by default) that picks the colour used. The first byte supplies additional flags for this option
;1 - change the colour for the version string only
;2 - underline text for the version string
;4 - use monospace font for the version string
;MainMenuFontColour=0x000055
;Change the colour of the font used on the main menu for the button text
;MainMenuBigFontColour=0x3C
;Uncomment the next four lines to move the main menu buttons and credit text (the 'Copyright(c)' line on the main menu)
;MainMenuOffsetX=392
;MainMenuOffsetY=26
;MainMenuCreditsOffsetX=0
;MainMenuCreditsOffsetY=0
;These options modify the bullet distribution of burst attacks
;All the bullets are divided into three groups: center, left, and right
;These groups will then travel along three parallel tracks, trying to hit targets on the way
;CenterMult/Div set the ratio of how many bullets go to the center group, and the remaining are divided equally to the left and right sides
;TargetMult/Div set the ratio of how many bullets in the center group will attack the primary target directly
;Multiplier values are capped at divisor values
;ComputeSpray_CenterMult=1
;ComputeSpray_CenterDiv=3
;ComputeSpray_TargetMult=1
;ComputeSpray_TargetDiv=2
;Set to 1 to make explosions and projectiles emit light
;ExplosionsEmitLight=1
;Uncomment these lines to change explosives damage. DmgMax can be set to 9999 at max, and DmgMin is capped at DmgMax
;Dynamite_DmgMax=50
;Dynamite_DmgMin=30
;PlasticExplosive_DmgMax=80
;PlasticExplosive_DmgMin=40
;To add additional game msg files, uncomment the next line and set a comma delimited list of filenames without .msg extension
;By default, the files will have consecutive numbers assigned beginning with 0
;You can use the syntax 'filename:number' to manually assign numbers to specific msg files, with each pair separated by a comma
;If a file after the specified pair does not have a number assigned, it will have the next consecutive number from the last pair
;You need to use the message_str_game script function to get messages from the files
;ExtraGameMsgFileList=
;Set to 1 to display numbered dialogue options
NumbersInDialogue=0
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; Configuration ini files
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
;To change the path and filename of the critical table file, uncomment the next line
;OverrideCriticalFile=config\CriticalOverrides.ini
;To add additional books to the game, uncomment the next line and point to a file containing book information
;See the Books.ini in the modders pack for an example file
;BooksFile=sfall\Books.ini
;Point to an ini file containing elevator data
;ElevatorsFile=config\Elevators.ini
;Allows you to change the requirements and effects of unarmed attacks
;See the Unarmed.ini in the modders pack for an example file
;UnarmedFile=sfall\Unarmed.ini
;To change some engine parameters for the game mechanics, uncomment the next line
;TweaksFile=sfall\Tweaks.ini
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[Scripts]
;Comma-separated list of masked paths to load global scripts from
;Only use single backslash \ as the directory separator
;Paths outside of scripts folder are supported
;GlobalScriptPaths=scripts\gl_*.int,scripts\sfall\gl*.int
;Uncomment the option to specify an additional directory for ini files used by scripts
;The game will search for ini files first relative to this directory and then relative to the root directory if not found
;The path length is limited to 61 characters
;IniConfigFolder=mods\iniConfigs
BIN
View File
Binary file not shown.
+50
View File
@@ -0,0 +1,50 @@
;hi-res configuration settings for Fallout 2 CE
;##################################################################################################################
[MAIN]
; Set SCALE_2X=1 to scale the game x2.
; Note: This will increase the minimum resolution to from 640x480 to 1280x960.
SCALE_2X=1
; Set the Fullscreen resolution here.
SCR_WIDTH=640
SCR_HEIGHT=480
; Set WINDOWED=1 to enable windowed mode.
WINDOWED=1
;##################################################################################################################
[IFACE]
; if IFACE_BAR_MODE=0 - the bottom of the map view window sits at the top of the IFACE Bar.
; if IFACE_BAR_MODE=1 - the bottom of the map view window extends to the base of the screen and is overlapped by the IFACE Bar.
IFACE_BAR_MODE=0
;if IFACE_BAR_SIDE_ART=0 - Black, No Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=1 - Metal (grey) look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=2 - Leather look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=3-6 - Alternative Metal look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=7 - Alternative Leather look Iface-bar side art used.
;if IFACE_BAR_SIDE_ART=8 - Metal (brown) look Iface-bar side art used.
IFACE_BAR_SIDE_ART=2
;if IFACE_BAR_SIDES_ORI=0 - Iface-bar side graphics extend from the Iface-Bar to the Screen edges.
;if IFACE_BAR_SIDES_ORI=1 - Iface-bar side graphics extend from the Screen edges to the Iface-Bar.
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. Note
IFACE_BAR_WIDTH=640
;##################################################################################################################
[STATIC_SCREENS]
; if set to 0 - background image will display at its original size.
; if set to 1 - background image will stretch to fit the screen while maintaining its aspect ratio.
; if set to 2 - background image will stretch to fill the screen.
SPLASH_SCRN_SIZE=2
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
docker run --rm \
-v $(pwd):/app --workdir /app \
--user $(id -u):$(id -g) silkeh/clang:18 \
bash -c 'find src -type f -name \*.cc -o -name \*.h | xargs clang-format -i'
+1
View File
@@ -0,0 +1 @@
*.int
+51
View File
@@ -0,0 +1,51 @@
# Testing sFall scripting features
## Basic info
This folder contains scripts which can be used for sFall opcodes.
## Building
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:
```sh
compile.exe -q -p -l -O2 -d -s -n -I<sfall_headers_id> <script_name.ssl>
```
(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)
## Run test script
1. Move compiled `.int` file into game folder as `data/scripts/gl_<script_name>.int`
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
+181
View File
@@ -0,0 +1,181 @@
#include "lib.arrays.h"
#include "test_utils.h"
// #include "define_lite.h"
#define ARRAY_MAX_STRING (255)
#define ARRAY_MAX_SIZE (100000)
procedure array_test_suite begin
variable arr, i, arr2, map, k, v, s;
test_suite_errors := 0;
display_msg("Testing arrays_equal functions...");
call assertEquals("array_equals 1", arrays_equal([9, 7, 2, 1], [9, 7, 2, 1]), true);
call assertEquals("array_equals 2", arrays_equal([9, 7, 0, 1], [9, 7, 2, 1]), false);
call assertEquals("array_equals 3", arrays_equal([1, 1, 1, 1], [1, 1, 1]), false);
call assertEquals("array_equals 4", arrays_equal([], []), true);
call assertEquals("array_equals 5", arrays_equal({}, []), false);
call assertEquals("array_equals 6", arrays_equal({1: 1.0, 2: 2.0}, {1: 1.000, 2: 2.000}), true);
call assertEquals("array_equals 7", arrays_equal({"name": "John", "dept": 15.20}, {"name": "John"}), false);
display_msg("Testing utility functions...");
call assertEquals("strlen", strlen("testing"), 7);
call assertEquals("substr 1", substr("testing", 4, 2), "in");
call assertEquals("substr 2", substr("testing", 1, -1), "estin");
call assertEquals("substr 3", substr("testing", -5, 5), "sting");
call assertEquals("typeof 1", typeof(1), VALTYPE_INT);
call assertEquals("typeof 2", typeof(1.0), VALTYPE_FLOAT);
call assertEquals("typeof 3", typeof("1.0"), VALTYPE_STR);
// Basic array functionality
display_msg("Testing basic arrays functionality...");
arr := create_array(5,0);
call assertEquals("array size", len_array(arr), 5);
arr[0]:=100;
call assertEquals("get array", get_array(arr, 0), 100);
arr[1]:=5.555;
call assertEquals("get array float", get_array(arr, 1), 5.555);
arr[2]:="hello";
call assertEquals("get array str", get_array(arr, 2), "hello");
call assertEquals("get array invalid index", get_array(arr, -1), 0);
call assertEquals("get array invalid index", get_array(arr, 6), 0);
resize_array(arr, 77);
call assertEquals("list resize", len_array(arr), 77);
resize_array(arr, ARRAY_MAX_SIZE + 100);
call assertEquals("resize max", len_array(arr), ARRAY_MAX_SIZE);
free_array(arr);
call assertEquals("not exists check", len_array(arr), -1);
arr := create_array(ARRAY_MAX_SIZE + 100, 0);
call assertEquals("create max", len_array(arr), ARRAY_MAX_SIZE);
free_array(arr);
arr := [6, 1, 10, "one", 10, "two", 5, "three"];
arr[0] := "wtf";
//display_msg(debug_array_str(arr));
call assertEquals("scan list", scan_array(arr, 10), 2);
call assertEquals("scan list 2", scan_array(arr, "two"), 5);
call assertEquals("array_key", array_key(arr, 5), 5);
call assertEquals("array_key out of range", array_key(arr, 9), 0);
call assertEquals("is list", array_key(arr, -1), 0);
call assertEquals("get array as substr", get_array("NiCe", 1), "i");
arr := [78, 12, 99, 1, -5];
sort_array(arr);
call assertEquals("sort ASC", arrays_equal(arr, [-5, 1, 12, 78, 99]), true);
arr := ["Albert", "John", "Mike", "David"];
sort_array_reverse(arr);
call assertEquals("sort DESC", arrays_equal(arr, ["Mike", "John", "David", "Albert"]), true);
reverse_array(arr);
call assertEquals("reverse list", arrays_equal(arr, ["Albert", "David", "John", "Mike"]), true);
shuffle_array(arr);
call assertEquals("shuffle list 1", arrays_equal(arr, ["Albert", "David", "John", "Mike"]), false);
call assertEquals("shuffle list 2", len_array(arr), 4);
if (test_suite_verbose) then display_array(arr);
// some additional stuff
call assertEquals("string_split", get_array(string_split("this+is+good", "+"), 2), "good");
call assertEquals("string_split 2", len_array(string_split("advice", "")), 6);
s := "";
for (i := 0; i < ARRAY_MAX_STRING+30; i+=10) begin
s += "Verbosity.";
end
arr[0] := s;
call assertEquals("array max string", strlen(arr[0]), ARRAY_MAX_STRING-1);
// ASSOC ARRAYS TEST
display_msg("Testing associative arrays...");
arr := create_array(-1,0);
call assertEquals("is map", array_key(arr, -1), 1);
call assertEquals("exists check", len_array(arr), 0);
arr["123"] := 100;
call assertEquals("set/get str=>int", arr["123"], 100);
arr["123"] := 50;
call assertEquals("overwrite 1", arr["123"], 50);
call assertEquals("overwrite 2", len_array(arr), 1);
arr[-1] := "wtf";
call assertEquals("set/get int=>str", arr[-1], "wtf");
arr[3.14] := 0.00001;
call assertEquals("set/get float=>float", arr[3.14], 0.00001);
arr["fourth"] := "elem";
call assertEquals("map size", len_array(arr), 4);
arr[-1] := 0;
call assertEquals("unset key: length", len_array(arr), 3);
call assertEquals("unset key: hashmap", arr[3.14], 0.00001);
call assertEquals("key not exist", arr[777], 0);
free_array(arr);
call assertEquals("not exists check", len_array(arr), -1);
arr := {6:5, 1.001:0.5, 10:"A", 5:0, "wtf":1.1, 10:0.0001, "some":"What"}; // 7 here
// 10:"A" will be overwritten by 10:0.0001
call assertEquals("assoc array expr", len_array(arr), 6); // 6 actual
call assertEquals("scan map 1", scan_array(arr, 1.1), "wtf");
call assertEquals("scan map 2", scan_array(arr, 5), 6);
call assertEquals("scan map 3", scan_array(arr, "What"), "some");
call assertEquals("array_key 1", array_key(arr, 0), 6);
call assertEquals("array_key 2", array_key(arr, 4), "wtf");
call assertEquals("array_key 3", array_key(arr, 1), 1.001);
resize_array(arr, 2);
call assertEquals("map resize 1", len_array(arr), 2);
call assertEquals("map resize 2", arrays_equal(arr, {6:5, 1.001:0.5}), true);
resize_array(arr, 0);
call assertEquals("map clear", len_array(arr), 0);
display_msg("Testing foreach...");
s := "ar";
arr := [6, 10, 0.5, "wtf"];
foreach v in arr begin
s += v;
end
call assertEquals("foreach 1", s, "ar6100.50000wtf");
s := "ar2=";
arr := {"name": "John", "hp": 25, 0: 5.5};
foreach k: v in arr begin
s += k+":"+v+";";
end
call assertEquals("foreach 2", s, "ar2=name:John;hp:25;0:5.50000;");
/*
display_msg("Testing save/load...");
arr := [2,1];
arr2 := {1:2};
save_array("myarray", arr);
call assertEquals("load 1", load_array("myarray"), arr);
save_array("myarray", arr2);
call assertEquals("load 2", load_array("myarray"), arr2);
free_array(arr2);
call assertEquals("not exists check", len_array(arr2), -1);
call assertEquals("load fail", load_array("myarray"), 0);
save_array(0.1, arr);
call assertEquals("save as float", load_array(0.1), arr);
arr2 := list_saved_arrays; // list of array names
//display_msg(debug_array_str(arr2));
call assertNotEquals("saved arrays 1", scan_array(arr2, 0.1), -1);
call assertEquals("saved arrays 2", scan_array(arr2, "myarray"), -1);
save_array(0, arr);
call assertEquals("unsave array 1", load_array(0.1), 0);
call assertEquals("unsave array 2", len_array(arr), 2);
call assertEquals("saved arrays 3", len_array(list_saved_arrays), len_array(arr2) - 1);
*/
display_msg("All tests finished with "+test_suite_errors+" errors.");
call report_test_results("arrays");
end
procedure start begin
display_msg("Starting tests");
call array_test_suite();
end
+71
View File
@@ -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
+15
View File
@@ -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
+82
View File
@@ -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
+162
View File
@@ -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
+112
View File
@@ -0,0 +1,112 @@
#ifndef TEST_UTILS_H
#define TEST_UTILS_H
#include "define_lite.h"
variable test_suite_errors := 0;
variable test_suite_verbose := false;
variable test_suite_assertions := 0;
procedure assertEquals(variable desc, variable a, variable b) begin
test_suite_assertions++;
if (a != b or typeof(a) != typeof(b)) then begin
display_msg("FAIL \""+desc+"\": "+a+" != "+b);
test_suite_errors ++;
end else if (test_suite_verbose) then begin
display_msg("ok \""+desc+"\"");
end
end
procedure assertNotEquals(variable desc, variable a, variable b) begin
test_suite_assertions++;
if (a == b) then begin
display_msg("FAIL \""+desc+"\": "+a+" == "+b);
test_suite_errors ++;
end else if (test_suite_verbose) then begin
display_msg("ok \""+desc+"\"");
end
end
procedure assertFloat(variable desc, variable a, variable b, variable tolerance = 0.001) begin
test_suite_assertions++;
variable diff := abs(a - b);
if (diff > tolerance) then begin
display_msg("FAIL \""+desc+"\": "+a+" != "+b+" (diff: "+diff+")");
test_suite_errors ++;
end else if (test_suite_verbose) then begin
display_msg("ok \""+desc+"\"");
end
end
procedure report_test_results(variable desc) begin
display_msg("DONE " + desc + " " +
(test_suite_assertions-test_suite_errors) + "/" + test_suite_assertions + "");
display_msg("================");
#define GL_VAR_TESTING_INFO_ARRAY_ID "TestArra"
#define TEST_ARR_IDENTIFIER_KEY "__testing_info_array__"
variable arr_id = get_sfall_global_int(GL_VAR_TESTING_INFO_ARRAY_ID);
if arr_id != 0 then begin
// Let's check that it is actually our testing array
if array_key(arr_id, -1) == 0 then begin
// It is not even associative array, so it is not our testing array
arr_id = 0;
end else begin
if arr_id[TEST_ARR_IDENTIFIER_KEY] != 1 then begin
// It is associative array, but it is not our testing array
arr_id = 0;
end
end
end
if arr_id == 0 then begin
arr_id = create_array(-1, 0);
arr_id[TEST_ARR_IDENTIFIER_KEY] = 1;
set_sfall_global(GL_VAR_TESTING_INFO_ARRAY_ID, arr_id);
end
#define TEST_SUITES "Test suites"
#define TEST_ASSERTIONS_TOTAL "Tests assertings total"
#define TEST_ASSERTIONS_FAILED "Tests assertings failed"
if arr_id[TEST_SUITES] == 0 then begin
arr_id[TEST_SUITES] = create_array(-1, 0);
end
//set_sfall_global("test_suite_errors", test_suite_errors);
arr_id[TEST_ASSERTIONS_TOTAL] += test_suite_assertions;
arr_id[TEST_ASSERTIONS_FAILED] += test_suite_errors;
arr_id[TEST_SUITES][desc] += 1;
variable total_suites_names = "";
variable total_suites_count = 0;
variable key, item;
foreach (key: item in arr_id[TEST_SUITES]) begin
total_suites_count += item;
if (total_suites_names != "") then begin
total_suites_names += ", ";
end
total_suites_names += key;
end
variable assertions_stats_str = (arr_id[TEST_ASSERTIONS_TOTAL]-arr_id[TEST_ASSERTIONS_FAILED]) +
"/" + arr_id[TEST_ASSERTIONS_TOTAL];
if (arr_id[TEST_ASSERTIONS_FAILED] == 0) then begin
float_msg(dude_obj, "Tested " + total_suites_count + " cases: " + total_suites_names + ". " +
assertions_stats_str + " assertions passed!", FLOAT_MSG_GREEN);
end else begin
float_msg(dude_obj, "Tested " + total_suites_count + " cases: " + total_suites_names + ". " +
assertions_stats_str + " assertions passed", FLOAT_MSG_RED);
end
end
#endif
+4
View File
@@ -3046,6 +3046,10 @@ void _dude_fidget()
return;
}
if (GameMode::getCurrentGameMode() == GameMode::kWorldmap) {
return;
}
if (isInCombat()) {
return;
}
+3 -3
View File
@@ -1769,7 +1769,7 @@ static int characterEditorWindowInit()
btn = buttonCreate(
gCharacterEditorWindow,
343,
344, // one pixel right shift to align with background
454,
_editorFrmImages[EDITOR_GRAPHIC_LITTLE_RED_BUTTON_UP].getWidth(),
_editorFrmImages[EDITOR_GRAPHIC_LITTLE_RED_BUTTON_UP].getHeight(),
@@ -1787,7 +1787,7 @@ static int characterEditorWindowInit()
btn = buttonCreate(
gCharacterEditorWindow,
552,
553, // one pixel right shift to align with background
454,
_editorFrmImages[EDITOR_GRAPHIC_LITTLE_RED_BUTTON_UP].getWidth(),
_editorFrmImages[EDITOR_GRAPHIC_LITTLE_RED_BUTTON_UP].getHeight(),
@@ -1805,7 +1805,7 @@ static int characterEditorWindowInit()
btn = buttonCreate(
gCharacterEditorWindow,
455,
456, // one pixel right shift to align with background
454,
_editorFrmImages[23].getWidth(),
_editorFrmImages[23].getHeight(),

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