mirror of
https://github.com/fallout2-ce/fallout2-ce.git
synced 2026-07-27 16:47:11 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
342fbdd3ae | ||
|
|
af413125bd | ||
|
|
afd99fa01b | ||
|
|
3e469ea8e8 | ||
|
|
ddefda32e7 | ||
|
|
0334b8de05 | ||
|
|
1cab275037 | ||
|
|
7eb269bab8 | ||
|
|
c18d7ab25e | ||
|
|
59bf337583 | ||
|
|
88179574e8 | ||
|
|
0733acfad7 | ||
|
|
1388ca1f83 |
@@ -14,16 +14,6 @@ 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
|
||||
|
||||
@@ -86,10 +76,6 @@ 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: |
|
||||
@@ -105,37 +91,10 @@ jobs:
|
||||
clean: false
|
||||
single-commit: true
|
||||
|
||||
|
||||
|
||||
- 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: |
|
||||
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:
|
||||
SITE_ORIGIN: https://${{ github.repository_owner }}.github.io
|
||||
SITE_BASE: ${{ steps.set-path.outputs.SITE_BASE }}
|
||||
|
||||
- name: Update deployment status
|
||||
- name: Comment preview URL on PR
|
||||
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 }}/
|
||||
|
||||
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 }}/"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -87,7 +87,7 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: os/android/app/.cxx
|
||||
key: android-cmake-v101
|
||||
key: android-cmake-v100
|
||||
|
||||
- name: Setup signing config
|
||||
if: env.KEYSTORE_FILE_BASE64 != '' && env.KEYSTORE_PROPERTIES_FILE_BASE64 != ''
|
||||
@@ -128,7 +128,7 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: ios-cmake-v101
|
||||
key: ios-cmake-v100
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
@@ -183,7 +183,7 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: linux-${{ matrix.arch }}-cmake-v101
|
||||
key: linux-${{ matrix.arch }}-cmake-v100
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
@@ -288,7 +288,7 @@ jobs:
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: macos-cmake-v101
|
||||
key: macos-cmake-v100
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
@@ -328,16 +328,16 @@ jobs:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Visual Studio 2022 Build Tools with v141_xp
|
||||
- name: Install Visual Studio 2019 Build Tools with v141_xp
|
||||
shell: cmd
|
||||
run: |
|
||||
choco install visualstudio2022buildtools -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'"
|
||||
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
|
||||
key: windows-${{ matrix.arch }}-cmake-v100
|
||||
|
||||
- name: Configure
|
||||
shell: cmd
|
||||
@@ -432,4 +432,4 @@ jobs:
|
||||
tag_name: continious
|
||||
draft: false
|
||||
prerelease: true
|
||||
name: Fallout2-CE Continuous Build
|
||||
name: Fallout2-CE Continuous Build
|
||||
@@ -12,7 +12,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
deployments: write
|
||||
steps:
|
||||
- name: Checkout gh-pages branch
|
||||
uses: actions/checkout@v4
|
||||
@@ -44,12 +43,4 @@ jobs:
|
||||
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
|
||||
fi
|
||||
+1
-7
@@ -288,16 +288,11 @@ 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"
|
||||
@@ -318,8 +313,7 @@ endif()
|
||||
if(WIN32)
|
||||
target_link_libraries(${EXECUTABLE_NAME}
|
||||
winmm
|
||||
debug libcpmtd
|
||||
optimized libcpmt
|
||||
libcpmt
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@
|
||||
"inherits": [
|
||||
"windows-base"
|
||||
],
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"architecture": "Win32",
|
||||
"cacheVariables": {
|
||||
"CMAKE_GENERATOR_TOOLSET": "v141_xp",
|
||||
@@ -42,7 +42,7 @@
|
||||
"inherits": [
|
||||
"windows-base"
|
||||
],
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"architecture": "x64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>"
|
||||
|
||||
@@ -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. **Note**: You must use "Offline backup game installer", not the main game installer.
|
||||
- Or if you're a Terminal user and have Homebrew installed you can extract the needed files from the GoG installer:
|
||||
|
||||
```console
|
||||
$ brew install innoextract
|
||||
@@ -96,16 +96,32 @@ 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, enable/disable fullscreen mode and configure IFACE settings (the control bar at the bottom of the game screen).
|
||||
Additionally, the [graphics] section provides options for fine tuning the appearence of the game. The included settings are:
|
||||
|
||||
```ini
|
||||
[MAIN]
|
||||
SCR_WIDTH=1280
|
||||
SCR_HEIGHT=720
|
||||
WINDOWED=1 ; 0 = fullscreen
|
||||
SCALE_2X=1 ; 0 = original scale, 1 = 2x - requires increasing the minimum resolution from 640x480 to 1280x960.
|
||||
```
|
||||
[graphics]
|
||||
fullscreen=0 ; 1 = fullscreeen, 0 = windowed
|
||||
game_height=480 ; main play area height
|
||||
game_width=640 ; main play area width
|
||||
scale2x=0 ; 0 = original scale, 1 = 2x - requires increasing the minimum resolution from 640x480 to 1280x960.
|
||||
splash_size=0 ; 0 = normal, 1 = aspect stretch, 2 = fullscreen stretch
|
||||
```
|
||||
|
||||
[IFACE]
|
||||
Recommendations:
|
||||
- **Desktops**: Use any size you see fit.
|
||||
- **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 graphcs settings will receive an in-game interface. For the time being it must be configured manually.
|
||||
|
||||
The second 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)
|
||||
|
||||
Further, Fallout2-CE supports the following additional settings in ddraw.ini:
|
||||
|
||||
```
|
||||
[Misc]
|
||||
; 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
|
||||
@@ -126,35 +142,13 @@ IFACE_BAR_SIDES_ORI=0
|
||||
;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
|
||||
|
||||
[STATIC_SCREENS]
|
||||
;if SPLASH_SCRN_SIZE=0 - Splash screen shows at original size if it fits, otherwise scales down while preserving aspect ratio.
|
||||
;if SPLASH_SCRN_SIZE=1 - Splash screen scales to fit the screen while preserving aspect ratio.
|
||||
;if SPLASH_SCRN_SIZE=2 - Splash screen stretches to fill the entire screen.
|
||||
SPLASH_SCRN_SIZE=0
|
||||
|
||||
[MAPS]
|
||||
;if IGNORE_MAP_EDGES=0 - Hi-Res map scroll edges are enabled.
|
||||
;if IGNORE_MAP_EDGES=1 - Hi-Res map scroll edges are ignored.
|
||||
IGNORE_MAP_EDGES=0
|
||||
```
|
||||
|
||||
Recommendations:
|
||||
- **Desktops**: Use any size you see fit.
|
||||
- **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. 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)
|
||||
|
||||
*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)
|
||||
*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 settings be found here: [f2_res.dat](https://github.com/fallout2-ce/fallout2-ce/raw/refs/heads/mainmenu/files/f2_res.dat)
|
||||
|
||||
## Quality of life benefits over vanilla Fallout
|
||||
|
||||
* High resolution support
|
||||
* Large game area support (through HiResMode=1 in ddraw.ini and game_height=480 and game_width=640 settings in fallout2.cfg)
|
||||
* 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
|
||||
|
||||
@@ -10,6 +10,33 @@
|
||||
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
[Misc]
|
||||
|
||||
; 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=5
|
||||
|
||||
|
||||
;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=1
|
||||
|
||||
;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.
|
||||
IFACE_BAR_WIDTH=800
|
||||
|
||||
;Adds Fallout 1 style travel/trail dots
|
||||
WorldMapTravelMarkers=0
|
||||
|
||||
;Prevents pausing music between map areas with the same music
|
||||
GaplessMusic=0
|
||||
|
||||
;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
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#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
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
#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
|
||||
@@ -1,30 +0,0 @@
|
||||
#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
|
||||
@@ -18,17 +18,6 @@ procedure assertTrue(variable desc, variable a) begin
|
||||
end
|
||||
end
|
||||
|
||||
procedure assertFalse(variable desc, variable a) begin
|
||||
test_suite_assertions++;
|
||||
|
||||
if (a) then begin
|
||||
display_msg("Assertion failed \""+desc+"\": is not false");
|
||||
test_suite_errors ++;
|
||||
end else if (test_suite_verbose) then begin
|
||||
display_msg("Assert \""+desc+"\" ok");
|
||||
end
|
||||
end
|
||||
|
||||
procedure assertEquals(variable desc, variable a, variable b) begin
|
||||
test_suite_assertions++;
|
||||
|
||||
|
||||
+45
-32
@@ -103,7 +103,7 @@ static int hideProjectile(void* _, void* projectile);
|
||||
// 0x410468
|
||||
int actionKnockdown(Object* obj, int* anim, int maxDistance, int rotation, int delay)
|
||||
{
|
||||
if (critterFlagCheck(obj->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
if (_critter_flag_check(obj->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ int _pick_death(Object* attacker, Object* defender, Object* weapon, int damage,
|
||||
|
||||
int violenceLevel = settings.preferences.violence_level;
|
||||
|
||||
if (critterFlagCheck(defender->pid, CRITTER_SPECIAL_DEATH)) {
|
||||
if (_critter_flag_check(defender->pid, CRITTER_SPECIAL_DEATH)) {
|
||||
return _check_death(defender, ANIM_EXPLODED_TO_NOTHING, VIOLENCE_LEVEL_NORMAL, hitFromFront);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ int _check_death(Object* obj, int anim, int minViolenceLevel, bool hitFromFront)
|
||||
// 0x4108C8
|
||||
int _internal_destroy(Object* _, Object* toDestroy)
|
||||
{
|
||||
return objectDestroy(toDestroy);
|
||||
return _obj_destroy(toDestroy);
|
||||
}
|
||||
|
||||
// TODO: Check very carefully, lots of conditions and jumps.
|
||||
@@ -297,12 +297,12 @@ void _show_damage_to_object(Object* defender, int damage, int flags, Object* wea
|
||||
int fid;
|
||||
const char* sfx_name;
|
||||
|
||||
if (critterFlagCheck(defender->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
if (_critter_flag_check(defender->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
knockbackDistance = 0;
|
||||
}
|
||||
|
||||
anim = FID_ANIM_TYPE(defender->fid);
|
||||
if (!critterIsProne(defender)) {
|
||||
if (!_critter_is_prone(defender)) {
|
||||
if ((flags & DAM_DEAD) != 0) {
|
||||
fid = buildFid(OBJ_TYPE_MISC, 10, 0, 0, 0);
|
||||
if (fid == attacker->fid) {
|
||||
@@ -447,7 +447,7 @@ void _show_damage_to_object(Object* defender, int damage, int flags, Object* wea
|
||||
|
||||
if (weapon != nullptr) {
|
||||
if ((flags & DAM_EXPLODE) != 0) {
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)objectDrop, -1);
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)_obj_drop, -1);
|
||||
fid = buildFid(OBJ_TYPE_MISC, 10, 0, 0, 0);
|
||||
animationRegisterSetFid(weapon, fid, 0);
|
||||
animationRegisterAnimateAndHide(weapon, ANIM_STAND, 0);
|
||||
@@ -459,7 +459,7 @@ void _show_damage_to_object(Object* defender, int damage, int flags, Object* wea
|
||||
} else if ((flags & DAM_DESTROY) != 0) {
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)_internal_destroy, -1);
|
||||
} else if ((flags & DAM_DROP) != 0) {
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)objectDrop, -1);
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)_obj_drop, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ int _show_death(Object* obj, int anim)
|
||||
}
|
||||
}
|
||||
|
||||
if (!critterFlagCheck(obj->pid, CRITTER_FLAT)) {
|
||||
if (!_critter_flag_check(obj->pid, CRITTER_FLAT)) {
|
||||
obj->flags |= OBJECT_NO_BLOCK;
|
||||
if (_obj_toggle_flat(obj, &tempRect) == 0) {
|
||||
rectUnion(&dirtyRect, &tempRect, &dirtyRect);
|
||||
@@ -499,7 +499,7 @@ int _show_death(Object* obj, int anim)
|
||||
rectUnion(&dirtyRect, &tempRect, &dirtyRect);
|
||||
}
|
||||
|
||||
if (anim >= 30 && anim <= 31 && !critterFlagCheck(obj->pid, CRITTER_SPECIAL_DEATH) && !critterFlagCheck(obj->pid, CRITTER_NO_DROP)) {
|
||||
if (anim >= 30 && anim <= 31 && !_critter_flag_check(obj->pid, CRITTER_SPECIAL_DEATH) && !_critter_flag_check(obj->pid, CRITTER_NO_DROP)) {
|
||||
itemDropAll(obj, obj->tile);
|
||||
}
|
||||
|
||||
@@ -1032,7 +1032,9 @@ int _action_climb_ladder(Object* critter, Object* ladder)
|
||||
reg_anim_begin(animationRequestOptions);
|
||||
|
||||
int tile = tileGetTileInDirection(ladder->tile, ROTATION_SE, 1);
|
||||
if (actionPoints != -1 || objectWithinWalkDistance(critter, ladder)) {
|
||||
int walkDistance = 5;
|
||||
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_USE_WALK_DISTANCE, &walkDistance);
|
||||
if (actionPoints != -1 || objectGetDistanceBetween(critter, ladder) < walkDistance) {
|
||||
animationRegisterMoveToTile(critter, tile, ladder->elevation, actionPoints, 0);
|
||||
} else {
|
||||
animationRegisterRunToTile(critter, tile, ladder->elevation, actionPoints, 0);
|
||||
@@ -1040,7 +1042,7 @@ int _action_climb_ladder(Object* critter, Object* ladder)
|
||||
|
||||
animationRegisterCallbackForced(critter, ladder, (AnimationCallback*)_is_next_to, -1);
|
||||
animationRegisterRotateToTile(critter, ladder->tile);
|
||||
animationRegisterCallbackForced(critter, ladder, (AnimationCallback*)checkSceneryUseActionPointCost, -1);
|
||||
animationRegisterCallbackForced(critter, ladder, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
|
||||
int weaponAnimationCode = (critter->fid & 0xF000) >> 12;
|
||||
if (weaponAnimationCode != 0) {
|
||||
@@ -1052,7 +1054,7 @@ int _action_climb_ladder(Object* critter, Object* ladder)
|
||||
const char* climbingSfx = sfxBuildCharName(critter, ANIM_CLIMB_LADDER, CHARACTER_SOUND_EFFECT_UNUSED);
|
||||
animationRegisterPlaySoundEffect(critter, climbingSfx, -1);
|
||||
animationRegisterAnimate(critter, ANIM_CLIMB_LADDER, 0);
|
||||
animationRegisterCallback(critter, ladder, (AnimationCallback*)objectUse, -1);
|
||||
animationRegisterCallback(critter, ladder, (AnimationCallback*)_obj_use, -1);
|
||||
|
||||
if (weaponAnimationCode != 0) {
|
||||
animationRegisterTakeOutWeapon(critter, weaponAnimationCode, -1);
|
||||
@@ -1099,7 +1101,9 @@ int _action_use_an_item_on_object(Object* user, Object* targetObj, Object* item)
|
||||
|
||||
reg_anim_begin(animationRequestOptions);
|
||||
|
||||
if (actionPoints != -1 || objectWithinWalkDistance(user, targetObj)) {
|
||||
int walkDistance = 5;
|
||||
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_USE_WALK_DISTANCE, &walkDistance);
|
||||
if (actionPoints != -1 || objectGetDistanceBetween(user, targetObj) < walkDistance) {
|
||||
animationRegisterMoveToObject(user, targetObj, actionPoints, 0);
|
||||
} else {
|
||||
animationRegisterRunToObject(user, targetObj, -1, 0);
|
||||
@@ -1108,7 +1112,7 @@ int _action_use_an_item_on_object(Object* user, Object* targetObj, Object* item)
|
||||
animationRegisterCallbackForced(user, targetObj, (AnimationCallback*)_is_next_to, -1);
|
||||
|
||||
if (item == nullptr) {
|
||||
animationRegisterCallback(user, targetObj, (AnimationCallback*)checkSceneryUseActionPointCost, -1);
|
||||
animationRegisterCallback(user, targetObj, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
}
|
||||
|
||||
int weaponAnimCode = (user->fid & 0xF000) >> 12;
|
||||
@@ -1120,9 +1124,9 @@ int _action_use_an_item_on_object(Object* user, Object* targetObj, Object* item)
|
||||
|
||||
int anim;
|
||||
int objectType = FID_TYPE(targetObj->fid);
|
||||
if (objectType == OBJ_TYPE_CRITTER && critterIsProne(targetObj)) {
|
||||
if (objectType == OBJ_TYPE_CRITTER && _critter_is_prone(targetObj)) {
|
||||
anim = ANIM_MAGIC_HANDS_GROUND;
|
||||
} else if (objectType == OBJ_TYPE_SCENERY && (proto->scenery.extendedFlags & PROTO_EXT_FLAG_MAGIC_HANDS_GROUND) != 0) {
|
||||
} else if (objectType == OBJ_TYPE_SCENERY && (proto->scenery.extendedFlags & 0x01) != 0) {
|
||||
anim = ANIM_MAGIC_HANDS_GROUND;
|
||||
} else {
|
||||
anim = ANIM_MAGIC_HANDS_MIDDLE;
|
||||
@@ -1134,9 +1138,9 @@ int _action_use_an_item_on_object(Object* user, Object* targetObj, Object* item)
|
||||
|
||||
if (item != nullptr) {
|
||||
// TODO: Get rid of cast.
|
||||
animationRegisterCallback3(user, targetObj, item, (AnimationCallback3*)objectUseItemOn, -1);
|
||||
animationRegisterCallback3(user, targetObj, item, (AnimationCallback3*)_obj_use_item_on, -1);
|
||||
} else {
|
||||
animationRegisterCallback(user, targetObj, (AnimationCallback*)objectUse, -1);
|
||||
animationRegisterCallback(user, targetObj, (AnimationCallback*)_obj_use, -1);
|
||||
}
|
||||
|
||||
if (weaponAnimCode != 0) {
|
||||
@@ -1169,12 +1173,15 @@ int actionPickUp(Object* critter, Object* item)
|
||||
}
|
||||
}
|
||||
|
||||
int walkDistance = 5;
|
||||
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_USE_WALK_DISTANCE, &walkDistance);
|
||||
|
||||
if (isInCombat()) {
|
||||
reg_anim_begin(ANIMATION_REQUEST_RESERVED);
|
||||
animationRegisterMoveToObject(critter, item, critter->data.critter.combat.ap, 0);
|
||||
} else {
|
||||
reg_anim_begin(critter == gDude ? ANIMATION_REQUEST_RESERVED : ANIMATION_REQUEST_UNRESERVED);
|
||||
if (!objectWithinWalkDistance(critter, item)) {
|
||||
if (objectGetDistanceBetween(critter, item) >= walkDistance) {
|
||||
animationRegisterRunToObject(critter, item, -1, 0);
|
||||
} else {
|
||||
animationRegisterMoveToObject(critter, item, -1, 0);
|
||||
@@ -1182,7 +1189,7 @@ int actionPickUp(Object* critter, Object* item)
|
||||
}
|
||||
|
||||
animationRegisterCallbackForced(critter, item, (AnimationCallback*)_is_next_to, -1);
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)checkSceneryUseActionPointCost, -1);
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
|
||||
Proto* itemProto;
|
||||
protoGetProto(item->pid, &itemProto);
|
||||
@@ -1207,7 +1214,7 @@ int actionPickUp(Object* critter, Object* item)
|
||||
animationRegisterPlaySoundEffect(item, sfx, actionFrame);
|
||||
}
|
||||
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)objectPickup, actionFrame);
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)_obj_pickup, actionFrame);
|
||||
} else {
|
||||
int weaponAnimationCode = (critter->fid & 0xF000) >> 12;
|
||||
if (weaponAnimationCode != 0) {
|
||||
@@ -1235,7 +1242,7 @@ int actionPickUp(Object* critter, Object* item)
|
||||
}
|
||||
|
||||
if (item->frame != 1) {
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)objectUseContainer, actionFrame);
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)_obj_use_container, actionFrame);
|
||||
}
|
||||
|
||||
if (weaponAnimationCode != 0) {
|
||||
@@ -1263,7 +1270,7 @@ int _action_loot_container(Object* critter, Object* container)
|
||||
}
|
||||
|
||||
// SFALL: Fix for trying to loot corpses with the "NoSteal" flag.
|
||||
if (critterFlagCheck(container->pid, CRITTER_NO_STEAL)) {
|
||||
if (_critter_flag_check(container->pid, CRITTER_NO_STEAL)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1274,13 +1281,16 @@ int _action_loot_container(Object* critter, Object* container)
|
||||
}
|
||||
}
|
||||
|
||||
int walkDistance = 5;
|
||||
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_USE_WALK_DISTANCE, &walkDistance);
|
||||
|
||||
if (isInCombat()) {
|
||||
reg_anim_begin(ANIMATION_REQUEST_RESERVED);
|
||||
animationRegisterMoveToObject(critter, container, critter->data.critter.combat.ap, 0);
|
||||
} else {
|
||||
reg_anim_begin(critter == gDude ? ANIMATION_REQUEST_RESERVED : ANIMATION_REQUEST_UNRESERVED);
|
||||
|
||||
if (objectWithinWalkDistance(critter, container)) {
|
||||
if (objectGetDistanceBetween(critter, container) < walkDistance) {
|
||||
animationRegisterMoveToObject(critter, container, -1, 0);
|
||||
} else {
|
||||
animationRegisterRunToObject(critter, container, -1, 0);
|
||||
@@ -1288,7 +1298,7 @@ int _action_loot_container(Object* critter, Object* container)
|
||||
}
|
||||
|
||||
animationRegisterCallbackForced(critter, container, (AnimationCallback*)_is_next_to, -1);
|
||||
animationRegisterCallback(critter, container, (AnimationCallback*)checkSceneryUseActionPointCost, -1);
|
||||
animationRegisterCallback(critter, container, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
animationRegisterCallback(critter, container, (AnimationCallback*)scriptsRequestLooting, -1);
|
||||
return reg_anim_end();
|
||||
}
|
||||
@@ -1478,13 +1488,16 @@ int actionUseSkill(Object* user, Object* target, int skill)
|
||||
}
|
||||
}
|
||||
|
||||
int walkDistance = 5;
|
||||
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_USE_WALK_DISTANCE, &walkDistance);
|
||||
|
||||
if (isInCombat()) {
|
||||
reg_anim_begin(ANIMATION_REQUEST_RESERVED);
|
||||
animationRegisterMoveToObject(performer, target, performer->data.critter.combat.ap, 0);
|
||||
} else {
|
||||
reg_anim_begin(user == gDude ? ANIMATION_REQUEST_RESERVED : ANIMATION_REQUEST_UNRESERVED);
|
||||
if (target != gDude) {
|
||||
if (!objectWithinWalkDistance(performer, target)) {
|
||||
if (objectGetDistanceBetween(performer, target) >= walkDistance) {
|
||||
animationRegisterRunToObject(performer, target, -1, 0);
|
||||
} else {
|
||||
animationRegisterMoveToObject(performer, target, -1, 0);
|
||||
@@ -1494,7 +1507,7 @@ int actionUseSkill(Object* user, Object* target, int skill)
|
||||
|
||||
animationRegisterCallbackForced(performer, target, (AnimationCallback*)_is_next_to, -1);
|
||||
|
||||
int anim = (FID_TYPE(target->fid) == OBJ_TYPE_CRITTER && critterIsProne(target)) ? ANIM_MAGIC_HANDS_GROUND : ANIM_MAGIC_HANDS_MIDDLE;
|
||||
int anim = (FID_TYPE(target->fid) == OBJ_TYPE_CRITTER && _critter_is_prone(target)) ? ANIM_MAGIC_HANDS_GROUND : ANIM_MAGIC_HANDS_MIDDLE;
|
||||
int fid = buildFid(OBJ_TYPE_CRITTER, performer->fid & 0xFFF, anim, 0, performer->rotation + 1);
|
||||
|
||||
CacheEntry* artHandle;
|
||||
@@ -1506,7 +1519,7 @@ int actionUseSkill(Object* user, Object* target, int skill)
|
||||
|
||||
animationRegisterAnimate(performer, anim, -1);
|
||||
// TODO: Get rid of casts.
|
||||
animationRegisterCallback3(performer, target, (void*)(uintptr_t)skill, (AnimationCallback3*)objectUseSkillOn, -1);
|
||||
animationRegisterCallback3(performer, target, (void*)(uintptr_t)skill, (AnimationCallback3*)_obj_use_skill_on, -1);
|
||||
return reg_anim_end();
|
||||
}
|
||||
|
||||
@@ -1753,7 +1766,7 @@ int _report_explosion(Attack* attack, Object* sourceObj)
|
||||
xp += critterGetExp(attack->defender);
|
||||
}
|
||||
} else {
|
||||
critterSetWhoHitMe(attack->defender, sourceObj);
|
||||
_critter_set_who_hit_me(attack->defender, sourceObj);
|
||||
anyDefender = attack->defender;
|
||||
}
|
||||
}
|
||||
@@ -1766,7 +1779,7 @@ int _report_explosion(Attack* attack, Object* sourceObj)
|
||||
xp += critterGetExp(critter);
|
||||
}
|
||||
} else {
|
||||
critterSetWhoHitMe(critter, sourceObj);
|
||||
_critter_set_who_hit_me(critter, sourceObj);
|
||||
|
||||
if (anyDefender == nullptr) {
|
||||
anyDefender = critter;
|
||||
@@ -1972,7 +1985,7 @@ int _report_dmg(Attack* attack, Object* _)
|
||||
// 0x413660
|
||||
int _compute_dmg_damage(int min, int max, Object* obj, int* knockbackDistancePtr, int damageType)
|
||||
{
|
||||
if (!critterFlagCheck(obj->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
if (!_critter_flag_check(obj->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
knockbackDistancePtr = nullptr;
|
||||
}
|
||||
|
||||
@@ -2046,7 +2059,7 @@ int actionPush(Object* obj, Object* target)
|
||||
}
|
||||
|
||||
int sid;
|
||||
if (objectGetSid(target, &sid) == 0) {
|
||||
if (_obj_sid(target, &sid) == 0) {
|
||||
scriptSetObjects(sid, obj, target);
|
||||
scriptExecProc(sid, SCRIPT_PROC_PUSH);
|
||||
|
||||
|
||||
+28
-30
@@ -1418,7 +1418,7 @@ static int animationRunSequence(int animationSequenceIndex)
|
||||
rc = _anim_animate(animationDescription->owner, animationDescription->anim, animationSequenceIndex, ANIM_SAD_FOREVER);
|
||||
break;
|
||||
case ANIM_KIND_ROTATE_TO_TILE:
|
||||
if (!critterIsProne(animationDescription->owner)) {
|
||||
if (!_critter_is_prone(animationDescription->owner)) {
|
||||
int rotation = tileGetRotationTo(animationDescription->owner->tile, animationDescription->tile);
|
||||
_dude_stand(animationDescription->owner, rotation, -1);
|
||||
}
|
||||
@@ -1637,7 +1637,7 @@ static int _anim_set_end(int animationSequenceIndex)
|
||||
}
|
||||
}
|
||||
|
||||
if ((animationSequence->flags & ANIM_SEQ_NO_STAND) == 0 && !critterIsProne(owner)) {
|
||||
if ((animationSequence->flags & ANIM_SEQ_NO_STAND) == 0 && !_critter_is_prone(owner)) {
|
||||
_dude_stand(owner, owner->rotation, -1);
|
||||
}
|
||||
}
|
||||
@@ -1713,18 +1713,16 @@ static bool canUseDoor(Object* critter, Object* door)
|
||||
}
|
||||
|
||||
// 0x415EE8
|
||||
int _make_path(Object* object, int from, int to, unsigned char* rotations, int requireEmptyDest)
|
||||
int _make_path(Object* object, int from, int to, unsigned char* rotations, int a5)
|
||||
{
|
||||
return pathfinderFindPath(object, from, to, rotations, requireEmptyDest, _obj_blocking_at);
|
||||
return pathfinderFindPath(object, from, to, rotations, a5, _obj_blocking_at);
|
||||
}
|
||||
|
||||
// TODO: move pathfinding into another unit
|
||||
// If requireEmptyDest == 1, will not return a path if the destination tile is blocked (according to `callback`).
|
||||
// Returns path length, or 0 if no path is available.
|
||||
// 0x415EFC
|
||||
int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotations, int requireEmptyDest, PathBuilderCallback* callback)
|
||||
int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotations, int a5, PathBuilderCallback* callback)
|
||||
{
|
||||
if (requireEmptyDest) {
|
||||
if (a5) {
|
||||
if (callback(object, to, object->elevation) != nullptr) {
|
||||
return 0;
|
||||
}
|
||||
@@ -1755,7 +1753,7 @@ int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotation
|
||||
|
||||
int toScreenX;
|
||||
int toScreenY;
|
||||
tileToScreenXY(to, &toScreenX, &toScreenY);
|
||||
tileToScreenXY(to, &toScreenX, &toScreenY, object->elevation);
|
||||
|
||||
int closedPathNodeListLength = 0;
|
||||
int openPathNodeListLength = 1;
|
||||
@@ -1840,7 +1838,7 @@ int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotation
|
||||
|
||||
int newX;
|
||||
int newY;
|
||||
tileToScreenXY(tile, &newX, &newY);
|
||||
tileToScreenXY(tile, &newX, &newY, object->elevation);
|
||||
|
||||
v27->estimate = _idist(newX, newY, toScreenX, toScreenY);
|
||||
v27->cost = temp.cost + 50;
|
||||
@@ -1940,11 +1938,11 @@ static int _tile_idistance(int tile1, int tile2)
|
||||
{
|
||||
int x1;
|
||||
int y1;
|
||||
tileToScreenXY(tile1, &x1, &y1);
|
||||
tileToScreenXY(tile1, &x1, &y1, gElevation);
|
||||
|
||||
int x2;
|
||||
int y2;
|
||||
tileToScreenXY(tile2, &x2, &y2);
|
||||
tileToScreenXY(tile2, &x2, &y2, gElevation);
|
||||
|
||||
return _idist(x1, y1, x2, y2);
|
||||
}
|
||||
@@ -1977,13 +1975,13 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
|
||||
int fromX;
|
||||
int fromY;
|
||||
tileToScreenXY(from, &fromX, &fromY);
|
||||
tileToScreenXY(from, &fromX, &fromY, obj->elevation);
|
||||
fromX += 16;
|
||||
fromY += 8;
|
||||
|
||||
int toX;
|
||||
int toY;
|
||||
tileToScreenXY(to, &toX, &toY);
|
||||
tileToScreenXY(to, &toX, &toY, obj->elevation);
|
||||
toX += 16;
|
||||
toY += 8;
|
||||
|
||||
@@ -2021,7 +2019,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
if (ddx <= ddy) {
|
||||
int middle = ddx - ddy / 2;
|
||||
while (true) {
|
||||
tile = tileFromScreenXY(tileX, tileY);
|
||||
tile = tileFromScreenXY(tileX, tileY, obj->elevation);
|
||||
|
||||
v22 += 1;
|
||||
if (v22 == a6) {
|
||||
@@ -2034,7 +2032,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = obj->elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, obj->elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2074,7 +2072,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
} else {
|
||||
int middle = ddy - ddx / 2;
|
||||
while (true) {
|
||||
tile = tileFromScreenXY(tileX, tileY);
|
||||
tile = tileFromScreenXY(tileX, tileY, obj->elevation);
|
||||
|
||||
v22 += 1;
|
||||
if (v22 == a6) {
|
||||
@@ -2087,7 +2085,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = obj->elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, obj->elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2136,7 +2134,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = obj->elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, obj->elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2201,13 +2199,13 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
|
||||
int fromX;
|
||||
int fromY;
|
||||
tileToScreenXY(from, &fromX, &fromY);
|
||||
tileToScreenXY(from, &fromX, &fromY, fromElevation);
|
||||
fromX += 16;
|
||||
fromY += 8;
|
||||
|
||||
int toX;
|
||||
int toY;
|
||||
tileToScreenXY(to, &toX, &toY);
|
||||
tileToScreenXY(to, &toX, &toY, toElevation);
|
||||
toX += 16;
|
||||
toY += 8;
|
||||
|
||||
@@ -2250,7 +2248,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
if (ddx > ddy) {
|
||||
int middle = ddy - ddx / 2;
|
||||
while (true) {
|
||||
tile = tileFromScreenXY(tileX, tileY);
|
||||
tile = tileFromScreenXY(tileX, tileY, elevation);
|
||||
|
||||
iteration += 1;
|
||||
if (iteration == 16) {
|
||||
@@ -2263,7 +2261,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2297,7 +2295,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
} else {
|
||||
int middle = ddx - ddy / 2;
|
||||
while (true) {
|
||||
tile = tileFromScreenXY(tileX, tileY);
|
||||
tile = tileFromScreenXY(tileX, tileY, elevation);
|
||||
|
||||
iteration += 1;
|
||||
if (iteration == 16) {
|
||||
@@ -2310,7 +2308,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2353,7 +2351,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2613,7 +2611,7 @@ static void _object_move(int index)
|
||||
}
|
||||
nextTile = -1;
|
||||
} else {
|
||||
objectUseDoor(object, obstacle, 0);
|
||||
_obj_use_door(object, obstacle, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2962,7 +2960,7 @@ int _check_move(int* actionPointsPtr)
|
||||
int y;
|
||||
mouseGetPosition(&x, &y);
|
||||
|
||||
int tile = tileFromScreenXY(x, y);
|
||||
int tile = tileFromScreenXY(x, y, gElevation);
|
||||
if (tile == -1) {
|
||||
return -1;
|
||||
}
|
||||
@@ -3219,7 +3217,7 @@ void _dude_standup(Object* a1)
|
||||
// 0x4185EC
|
||||
static int actionRotate(Object* obj, int delta, int animationSequenceIndex)
|
||||
{
|
||||
if (!critterIsProne(obj)) {
|
||||
if (!_critter_is_prone(obj)) {
|
||||
int rotation = obj->rotation + delta;
|
||||
if (rotation >= ROTATION_COUNT) {
|
||||
rotation = ROTATION_NE;
|
||||
@@ -3293,7 +3291,7 @@ static int _check_gravity(int tile, int elevation)
|
||||
for (; elevation > 0; elevation--) {
|
||||
int x;
|
||||
int y;
|
||||
tileToScreenXY(tile, &x, &y);
|
||||
tileToScreenXY(tile, &x, &y, elevation);
|
||||
|
||||
int squareTile = squareTileFromScreenXY(x + 2, y + 8, elevation);
|
||||
int fid = buildFid(OBJ_TYPE_TILE, _square[elevation]->field_0[squareTile] & 0xFFF, 0, 0, 0);
|
||||
|
||||
+2
-2
@@ -143,8 +143,8 @@ int animationRegisterToggleOutline(Object* object, bool outline, int delay);
|
||||
int animationRegisterPlaySoundEffect(Object* owner, const char* soundEffectName, int delay);
|
||||
int animationRegisterAnimateForever(Object* owner, int anim, int delay);
|
||||
int animationRegisterPing(int flags, int delay);
|
||||
int _make_path(Object* object, int from, int to, unsigned char* rotations, int requireEmptyDest);
|
||||
int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotations, int requireEmptyDest, PathBuilderCallback* callback);
|
||||
int _make_path(Object* object, int from, int to, unsigned char* a4, int a5);
|
||||
int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotations, int a5, PathBuilderCallback* callback);
|
||||
int _make_straight_path(Object* object, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6);
|
||||
int _make_straight_path_func(Object* object, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6, PathBuilderCallback* callback);
|
||||
void _object_animate();
|
||||
|
||||
+53
-64
@@ -1,6 +1,5 @@
|
||||
#include "art.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -542,72 +541,72 @@ int artCopyFileName(int objectType, int id, char* dest)
|
||||
}
|
||||
|
||||
// 0x419314
|
||||
int _art_get_code(int animation, int weaponType, char* weaponCodePtr, char* animationCodePtr)
|
||||
int _art_get_code(int animation, int weaponType, char* a3, char* a4)
|
||||
{
|
||||
if (weaponType < 0 || weaponType >= WEAPON_ANIMATION_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (animation >= ANIM_TAKE_OUT && animation <= ANIM_FIRE_CONTINUOUS) {
|
||||
*animationCodePtr = 'c' + (animation - ANIM_TAKE_OUT);
|
||||
*a4 = 'c' + (animation - ANIM_TAKE_OUT);
|
||||
if (weaponType == WEAPON_ANIMATION_NONE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*weaponCodePtr = 'd' + (weaponType - 1);
|
||||
*a3 = 'd' + (weaponType - 1);
|
||||
return 0;
|
||||
} else if (animation == ANIM_PRONE_TO_STANDING) {
|
||||
*animationCodePtr = 'h';
|
||||
*weaponCodePtr = 'c';
|
||||
*a4 = 'h';
|
||||
*a3 = 'c';
|
||||
return 0;
|
||||
} else if (animation == ANIM_BACK_TO_STANDING) {
|
||||
*animationCodePtr = 'j';
|
||||
*weaponCodePtr = 'c';
|
||||
*a4 = 'j';
|
||||
*a3 = 'c';
|
||||
return 0;
|
||||
} else if (animation == ANIM_CALLED_SHOT_PIC) {
|
||||
*animationCodePtr = 'a';
|
||||
*weaponCodePtr = 'n';
|
||||
*a4 = 'a';
|
||||
*a3 = 'n';
|
||||
return 0;
|
||||
} else if (animation >= FIRST_SF_DEATH_ANIM) {
|
||||
*animationCodePtr = 'a' + (animation - FIRST_SF_DEATH_ANIM);
|
||||
*weaponCodePtr = 'r';
|
||||
*a4 = 'a' + (animation - FIRST_SF_DEATH_ANIM);
|
||||
*a3 = 'r';
|
||||
return 0;
|
||||
} else if (animation >= FIRST_KNOCKDOWN_AND_DEATH_ANIM) {
|
||||
*animationCodePtr = 'a' + (animation - FIRST_KNOCKDOWN_AND_DEATH_ANIM);
|
||||
*weaponCodePtr = 'b';
|
||||
*a4 = 'a' + (animation - FIRST_KNOCKDOWN_AND_DEATH_ANIM);
|
||||
*a3 = 'b';
|
||||
return 0;
|
||||
} else if (animation == ANIM_THROW_ANIM) {
|
||||
if (weaponType == WEAPON_ANIMATION_KNIFE) {
|
||||
// knife
|
||||
*weaponCodePtr = 'd';
|
||||
*animationCodePtr = 'm';
|
||||
*a3 = 'd';
|
||||
*a4 = 'm';
|
||||
} else if (weaponType == WEAPON_ANIMATION_SPEAR) {
|
||||
// spear
|
||||
*weaponCodePtr = 'g';
|
||||
*animationCodePtr = 'm';
|
||||
*a3 = 'g';
|
||||
*a4 = 'm';
|
||||
} else {
|
||||
// other -> probably rock or grenade
|
||||
*weaponCodePtr = 'a';
|
||||
*animationCodePtr = 's';
|
||||
*a3 = 'a';
|
||||
*a4 = 's';
|
||||
}
|
||||
return 0;
|
||||
} else if (animation == ANIM_DODGE_ANIM) {
|
||||
if (weaponType <= 0) {
|
||||
*weaponCodePtr = 'a';
|
||||
*animationCodePtr = 'n';
|
||||
*a3 = 'a';
|
||||
*a4 = 'n';
|
||||
} else {
|
||||
*weaponCodePtr = 'd' + (weaponType - 1);
|
||||
*animationCodePtr = 'e';
|
||||
*a3 = 'd' + (weaponType - 1);
|
||||
*a4 = 'e';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
*animationCodePtr = 'a' + animation;
|
||||
*a4 = 'a' + animation;
|
||||
if (animation <= ANIM_WALK && weaponType > 0) {
|
||||
*weaponCodePtr = 'd' + (weaponType - 1);
|
||||
*a3 = 'd' + (weaponType - 1);
|
||||
return 0;
|
||||
}
|
||||
*weaponCodePtr = 'a';
|
||||
*a3 = 'a';
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -615,51 +614,53 @@ int _art_get_code(int animation, int weaponType, char* weaponCodePtr, char* anim
|
||||
// 0x419428
|
||||
char* artBuildFilePath(int fid)
|
||||
{
|
||||
int baseFid = fid;
|
||||
int rotation = FID_ROTATION(fid);
|
||||
int v1, v2, v3, v4, v5, type, v8, v10;
|
||||
char v9, v11, v12;
|
||||
|
||||
int aliasFid = artAliasFid(fid);
|
||||
if (aliasFid != -1) {
|
||||
baseFid = aliasFid;
|
||||
v2 = fid;
|
||||
|
||||
v10 = (fid & 0x70000000) >> 28;
|
||||
|
||||
v1 = artAliasFid(fid);
|
||||
if (v1 != -1) {
|
||||
v2 = v1;
|
||||
}
|
||||
|
||||
*_art_name = '\0';
|
||||
|
||||
int frmId = baseFid & 0xFFF;
|
||||
int animType = FID_ANIM_TYPE(baseFid);
|
||||
int weaponCode = (baseFid & 0xF000) >> 12;
|
||||
int objectType = FID_TYPE(baseFid);
|
||||
v3 = v2 & 0xFFF;
|
||||
v4 = FID_ANIM_TYPE(v2);
|
||||
v5 = (v2 & 0xF000) >> 12;
|
||||
type = FID_TYPE(v2);
|
||||
|
||||
if (objectType < OBJ_TYPE_ITEM || objectType >= OBJ_TYPE_COUNT) {
|
||||
if (type < OBJ_TYPE_ITEM || type >= OBJ_TYPE_COUNT) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (frmId >= gArtListDescriptions[objectType].fileNamesLength) {
|
||||
if (v3 >= gArtListDescriptions[type].fileNamesLength) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int fileNameOffset = frmId * 13;
|
||||
v8 = v3 * 13;
|
||||
|
||||
if (objectType == OBJ_TYPE_CRITTER) {
|
||||
char critterWeaponCode;
|
||||
char critterAnimationCode;
|
||||
if (_art_get_code(animType, weaponCode, &critterWeaponCode, &critterAnimationCode) == -1) {
|
||||
if (type == 1) {
|
||||
if (_art_get_code(v4, v5, &v11, &v12) == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
if (rotation != 0) {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.fr%c", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_CRITTER].name, gArtListDescriptions[OBJ_TYPE_CRITTER].fileNames + fileNameOffset, critterWeaponCode, critterAnimationCode, rotation + 47);
|
||||
if (v10) {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.fr%c", _cd_path_base, "art\\", gArtListDescriptions[1].name, gArtListDescriptions[1].fileNames + v8, v11, v12, v10 + 47);
|
||||
} else {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.frm", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_CRITTER].name, gArtListDescriptions[OBJ_TYPE_CRITTER].fileNames + fileNameOffset, critterWeaponCode, critterAnimationCode);
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.frm", _cd_path_base, "art\\", gArtListDescriptions[1].name, gArtListDescriptions[1].fileNames + v8, v11, v12);
|
||||
}
|
||||
} else if (objectType == OBJ_TYPE_HEAD) {
|
||||
char headSuffix = _head2[animType];
|
||||
if (headSuffix == 'f') {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c%d.frm", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_HEAD].name, gArtListDescriptions[OBJ_TYPE_HEAD].fileNames + fileNameOffset, _head1[animType], 102, weaponCode);
|
||||
} else if (type == 8) {
|
||||
v9 = _head2[v4];
|
||||
if (v9 == 'f') {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c%d.frm", _cd_path_base, "art\\", gArtListDescriptions[8].name, gArtListDescriptions[8].fileNames + v8, _head1[v4], 102, v5);
|
||||
} else {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.frm", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_HEAD].name, gArtListDescriptions[OBJ_TYPE_HEAD].fileNames + fileNameOffset, _head1[animType], headSuffix);
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.frm", _cd_path_base, "art\\", gArtListDescriptions[8].name, gArtListDescriptions[8].fileNames + v8, _head1[v4], v9);
|
||||
}
|
||||
} else {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s", _cd_path_base, "art\\", gArtListDescriptions[objectType].name, gArtListDescriptions[objectType].fileNames + fileNameOffset);
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s", _cd_path_base, "art\\", gArtListDescriptions[type].name, gArtListDescriptions[type].fileNames + v8);
|
||||
}
|
||||
|
||||
return _art_name;
|
||||
@@ -701,13 +702,8 @@ static int artReadList(const char* path, char** artListPtr, int* artListSizePtr)
|
||||
artList[12] = '\0';
|
||||
|
||||
artList += 13;
|
||||
|
||||
count--;
|
||||
}
|
||||
|
||||
// Sanity check. There was a bug with uncompressed database file seek
|
||||
assert(count == 0);
|
||||
|
||||
fileClose(stream);
|
||||
|
||||
return 0;
|
||||
@@ -1010,13 +1006,6 @@ static void artCacheFreeImpl(void* ptr)
|
||||
internal_free(ptr);
|
||||
}
|
||||
|
||||
/* FID Structure:
|
||||
3 bits for rotation
|
||||
4 bits for object type
|
||||
8 bits for animation type
|
||||
4 bits for weapon code
|
||||
12 bits for frame ID
|
||||
*/
|
||||
static int buildFidInternal(unsigned short frmId, unsigned char weaponCode, unsigned char animType, unsigned char objectType, unsigned char rotation)
|
||||
{
|
||||
return ((rotation << 28) & 0x70000000) | (objectType << 24) | ((animType << 16) & 0xFF0000) | ((weaponCode << 12) & 0xF000) | (frmId & 0xFFF);
|
||||
|
||||
@@ -129,8 +129,8 @@ unsigned char* artLockFrameData(int fid, int frame, int direction, CacheEntry**
|
||||
unsigned char* artLockFrameDataReturningSize(int fid, CacheEntry** out_cache_entry, int* widthPtr, int* heightPtr);
|
||||
int artUnlock(CacheEntry* cache_entry);
|
||||
int artCacheFlush();
|
||||
int artCopyFileName(int objectType, int id, char* dest);
|
||||
int _art_get_code(int animation, int weaponType, char* weaponCodePtr, char* animationCodePtr);
|
||||
int artCopyFileName(int objectType, int id, char* a3);
|
||||
int _art_get_code(int animation, int weaponType, char* a3, char* a4);
|
||||
char* artBuildFilePath(int fid);
|
||||
int artGetFramesPerSecond(Art* art);
|
||||
int artGetActionFrame(Art* art);
|
||||
@@ -138,7 +138,7 @@ int artGetFrameCount(Art* art);
|
||||
int artGetWidth(Art* art, int frame, int direction);
|
||||
int artGetHeight(Art* art, int frame, int direction);
|
||||
int artGetSize(Art* art, int frame, int direction, int* out_width, int* out_height);
|
||||
int artGetFrameOffsets(Art* art, int frame, int direction, int* xPtr, int* yPtr);
|
||||
int artGetFrameOffsets(Art* art, int frame, int direction, int* a4, int* a5);
|
||||
int artGetRotationOffsets(Art* art, int rotation, int* out_offset_x, int* out_offset_y);
|
||||
unsigned char* artGetFrameData(Art* art, int frame, int direction);
|
||||
ArtFrame* artGetFrame(Art* art, int frame, int direction);
|
||||
|
||||
+6
-6
@@ -148,7 +148,7 @@ long audioSeek(int handle, long offset, int origin)
|
||||
{
|
||||
int pos;
|
||||
unsigned char* buf;
|
||||
int remainingBytesToSkip;
|
||||
int v10;
|
||||
|
||||
Audio* audioFile = &(gAudioList[handle - 1]);
|
||||
|
||||
@@ -189,14 +189,14 @@ long audioSeek(int handle, long offset, int origin)
|
||||
}
|
||||
} else {
|
||||
buf = (unsigned char*)internal_malloc_safe(1024, __FILE__, __LINE__); // "..\int\audio.c", 321
|
||||
remainingBytesToSkip = audioFile->position - pos;
|
||||
while (remainingBytesToSkip > 1024) {
|
||||
remainingBytesToSkip -= 1024;
|
||||
v10 = audioFile->position - pos;
|
||||
while (v10 > 1024) {
|
||||
v10 -= 1024;
|
||||
audioRead(handle, buf, 1024);
|
||||
}
|
||||
|
||||
if (remainingBytesToSkip != 0) {
|
||||
audioRead(handle, buf, remainingBytesToSkip);
|
||||
if (v10 != 0) {
|
||||
audioRead(handle, buf, v10);
|
||||
}
|
||||
|
||||
// TODO: Probably leaks memory.
|
||||
|
||||
+11
-11
@@ -148,26 +148,26 @@ long audioFileSeek(int handle, long offset, int origin)
|
||||
{
|
||||
void* buf;
|
||||
int remaining;
|
||||
int targetPosition;
|
||||
int a4;
|
||||
|
||||
AudioFile* audioFile = &(gAudioFileList[handle - 1]);
|
||||
|
||||
switch (origin) {
|
||||
case SEEK_SET:
|
||||
targetPosition = offset;
|
||||
a4 = offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
targetPosition = audioFile->fileSize + offset;
|
||||
a4 = audioFile->fileSize + offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
targetPosition = audioFile->position + offset;
|
||||
a4 = audioFile->position + offset;
|
||||
break;
|
||||
default:
|
||||
assert(false && "Should be unreachable");
|
||||
}
|
||||
|
||||
if ((audioFile->flags & AUDIO_FILE_COMPRESSED) != 0) {
|
||||
if (targetPosition <= audioFile->position) {
|
||||
if (a4 <= audioFile->position) {
|
||||
soundDecoderFree(audioFile->soundDecoder);
|
||||
|
||||
fseek(audioFile->stream, 0, 0);
|
||||
@@ -176,20 +176,20 @@ long audioFileSeek(int handle, long offset, int origin)
|
||||
audioFile->fileSize *= 2;
|
||||
audioFile->position = 0;
|
||||
|
||||
if (targetPosition != 0) {
|
||||
if (a4) {
|
||||
buf = internal_malloc_safe(4096, __FILE__, __LINE__); // "..\int\audiof.c", 364
|
||||
while (targetPosition > 4096) {
|
||||
while (a4 > 4096) {
|
||||
audioFileRead(handle, buf, 4096);
|
||||
targetPosition -= 4096;
|
||||
a4 -= 4096;
|
||||
}
|
||||
if (targetPosition != 0) {
|
||||
audioFileRead(handle, buf, targetPosition);
|
||||
if (a4 != 0) {
|
||||
audioFileRead(handle, buf, a4);
|
||||
}
|
||||
internal_free_safe(buf, __FILE__, __LINE__); // "..\int\audiof.c", 370
|
||||
}
|
||||
} else {
|
||||
buf = internal_malloc_safe(0x400, __FILE__, __LINE__); // "..\int\audiof.c", 316
|
||||
remaining = audioFile->position - targetPosition;
|
||||
remaining = audioFile->position - a4;
|
||||
while (remaining > 1024) {
|
||||
audioFileRead(handle, buf, 1024);
|
||||
remaining -= 1024;
|
||||
|
||||
+26
-27
@@ -324,8 +324,7 @@ void automapShow(bool isInGame, bool isUsingScanner)
|
||||
|
||||
int automapWindowX = (screenGetWidth() - AUTOMAP_WINDOW_WIDTH) / 2;
|
||||
int automapWindowY = (screenGetHeight() - AUTOMAP_WINDOW_HEIGHT) / 2;
|
||||
// adding WINDOW_TRANSPARENT and WINDOW_DRAGGABLE_BY_BACKGROUND for testing temporarily
|
||||
int window = windowCreate(automapWindowX, automapWindowY, AUTOMAP_WINDOW_WIDTH, AUTOMAP_WINDOW_HEIGHT, color, WINDOW_MODAL | WINDOW_MOVE_ON_TOP | WINDOW_TRANSPARENT | WINDOW_DRAGGABLE_BY_BACKGROUND);
|
||||
int window = windowCreate(automapWindowX, automapWindowY, AUTOMAP_WINDOW_WIDTH, AUTOMAP_WINDOW_HEIGHT, color, WINDOW_MODAL | WINDOW_MOVE_ON_TOP);
|
||||
|
||||
int scannerBtn = buttonCreate(window,
|
||||
111,
|
||||
@@ -373,7 +372,7 @@ void automapShow(bool isInGame, bool isUsingScanner)
|
||||
frmImages[AUTOMAP_FRM_SWITCH_UP].getData(),
|
||||
frmImages[AUTOMAP_FRM_SWITCH_DOWN].getData(),
|
||||
nullptr,
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_CHECKABLE);
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_0x01);
|
||||
if (switchBtn != -1) {
|
||||
buttonSetCallbacks(switchBtn, _gsound_toggle_butt_press_, _gsound_toggle_butt_press_);
|
||||
}
|
||||
@@ -550,7 +549,7 @@ static void automapRenderInMapWindow(int window, int elevation, unsigned char* b
|
||||
}
|
||||
}
|
||||
|
||||
int pixelOffset = -2 * (object->tile % 200) - 10 + AUTOMAP_WINDOW_WIDTH * (2 * (object->tile / 200) + 9) - 60;
|
||||
int v10 = -2 * (object->tile % 200) - 10 + AUTOMAP_WINDOW_WIDTH * (2 * (object->tile / 200) + 9) - 60;
|
||||
if ((flags & AUTOMAP_IN_GAME) == 0) {
|
||||
switch (objectType) {
|
||||
case OBJ_TYPE_ITEM:
|
||||
@@ -574,28 +573,28 @@ static void automapRenderInMapWindow(int window, int elevation, unsigned char* b
|
||||
}
|
||||
|
||||
if (objectColor != _colorTable[0]) {
|
||||
unsigned char* pixel = windowBuffer + pixelOffset;
|
||||
unsigned char* v12 = windowBuffer + v10;
|
||||
if ((flags & AUTOMAP_IN_GAME) != 0) {
|
||||
if (*pixel != _colorTable[992] || objectColor != _colorTable[480]) {
|
||||
pixel[0] = objectColor;
|
||||
pixel[1] = objectColor;
|
||||
if (*v12 != _colorTable[992] || objectColor != _colorTable[480]) {
|
||||
v12[0] = objectColor;
|
||||
v12[1] = objectColor;
|
||||
}
|
||||
|
||||
if (object == gDude) {
|
||||
pixel[-1] = objectColor;
|
||||
pixel[-AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
v12[-1] = objectColor;
|
||||
v12[-AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
}
|
||||
} else {
|
||||
pixel[0] = objectColor;
|
||||
pixel[1] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH + 1] = objectColor;
|
||||
v12[0] = objectColor;
|
||||
v12[1] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH + 1] = objectColor;
|
||||
|
||||
pixel[AUTOMAP_WINDOW_WIDTH - 1] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH + 2] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH * 2] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH * 2 + 1] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH - 1] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH + 2] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH * 2] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH * 2 + 1] = objectColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -639,8 +638,8 @@ int automapRenderInPipboyWindow(int window, int map, int elevation)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int bitsRemaining = 0; // Number of 2-bit tile entries left in `byte`.
|
||||
unsigned char byte = 0;
|
||||
int v1 = 0;
|
||||
unsigned char v2 = 0;
|
||||
unsigned char* ptr = gAutomapEntry.data;
|
||||
|
||||
// FIXME: This loop is implemented incorrectly. Automap requires 400x400 px,
|
||||
@@ -650,13 +649,13 @@ int automapRenderInPipboyWindow(int window, int map, int elevation)
|
||||
// crash.
|
||||
for (int y = 0; y < HEX_GRID_HEIGHT; y++) {
|
||||
for (int x = 0; x < HEX_GRID_WIDTH; x++) {
|
||||
bitsRemaining -= 1;
|
||||
if (bitsRemaining <= 0) {
|
||||
bitsRemaining = 4;
|
||||
byte = *ptr++;
|
||||
v1 -= 1;
|
||||
if (v1 <= 0) {
|
||||
v1 = 4;
|
||||
v2 = *ptr++;
|
||||
}
|
||||
|
||||
switch ((byte & 0xC0) >> 6) {
|
||||
switch ((v2 & 0xC0) >> 6) {
|
||||
case 1:
|
||||
*windowBuffer++ = wallColor;
|
||||
*windowBuffer++ = wallColor;
|
||||
@@ -670,7 +669,7 @@ int automapRenderInPipboyWindow(int window, int map, int elevation)
|
||||
break;
|
||||
}
|
||||
|
||||
byte <<= 2;
|
||||
v2 <<= 2;
|
||||
}
|
||||
|
||||
windowBuffer += 640 + 240;
|
||||
|
||||
+12
-12
@@ -575,26 +575,26 @@ static bool cacheSetCapacity(Cache* cache, int newCapacity)
|
||||
// 0x420A74
|
||||
static int cacheEntriesCompareByUsage(const void* a1, const void* a2)
|
||||
{
|
||||
CacheEntry* lhs = *(CacheEntry**)a1;
|
||||
CacheEntry* rhs = *(CacheEntry**)a2;
|
||||
CacheEntry* v1 = *(CacheEntry**)a1;
|
||||
CacheEntry* v2 = *(CacheEntry**)a2;
|
||||
|
||||
if (lhs->referenceCount != 0 && rhs->referenceCount == 0) {
|
||||
if (v1->referenceCount != 0 && v2->referenceCount == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (rhs->referenceCount != 0 && lhs->referenceCount == 0) {
|
||||
if (v2->referenceCount != 0 && v1->referenceCount == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lhs->hits < rhs->hits) {
|
||||
if (v1->hits < v2->hits) {
|
||||
return -1;
|
||||
} else if (lhs->hits > rhs->hits) {
|
||||
} else if (v1->hits > v2->hits) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (lhs->mru < rhs->mru) {
|
||||
if (v1->mru < v2->mru) {
|
||||
return -1;
|
||||
} else if (lhs->mru > rhs->mru) {
|
||||
} else if (v1->mru > v2->mru) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -604,12 +604,12 @@ static int cacheEntriesCompareByUsage(const void* a1, const void* a2)
|
||||
// 0x420AE8
|
||||
static int cacheEntriesCompareByMostRecentHit(const void* a1, const void* a2)
|
||||
{
|
||||
CacheEntry* lhs = *(CacheEntry**)a1;
|
||||
CacheEntry* rhs = *(CacheEntry**)a2;
|
||||
CacheEntry* v1 = *(CacheEntry**)a1;
|
||||
CacheEntry* v2 = *(CacheEntry**)a2;
|
||||
|
||||
if (lhs->mru < rhs->mru) {
|
||||
if (v1->mru < v2->mru) {
|
||||
return 1;
|
||||
} else if (lhs->mru > rhs->mru) {
|
||||
} else if (v1->mru > v2->mru) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user