Compare commits

..
Author SHA1 Message Date
github-actions[bot] 75a9303579 chore: auto-format with clang-format 2025-05-29 06:28:28 +00:00
Mike Klaas 30a6a8b2d1 Proper scrollwheel support in Perks/Karma/Kills folder 2025-05-28 23:24:26 -07:00
cambragol 016c83bc48 Inventory Item not Disappearing Fix (#161)
Fixes #160 

Conditional was incorrect.
2025-05-28 21:58:23 -07: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
24 changed files with 876 additions and 277 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
+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.
+207
View File
@@ -0,0 +1,207 @@
;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
;HiResMode=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
+33
View File
@@ -0,0 +1,33 @@
# Testing sFall scripting features
## Basic info
This folder contains scripts which can be used for sFall opcodes.
## Build script using sFall Script Editor
1. Get "Fallout sFall Script Editor v4.1.7.RC1", for example from https://nuclear-grot.ucoz.net/forum/12-20-1
2. Run script editor, add "sfall_headers" into "Location folder of headers files" in the options
3. Open any script here and compile it
4. This shoud create compiled script <file.int>
## Run test script
1. Move compiled .int file into game folder as `mods/tests/SCRIPTS/OBJ_DUDE.INT` (case-sensitive!)
2. Change `mods/mods_order.txt` file: add a line `tests` there
3. Run game, check that game displays message about tests
4. Comment tests line in `mods/mods_order.txt` in order to enable game back
## TODO
- Use custom global script instead of `obj_dude`
- Add note about compile.exe and https://marketplace.visualstudio.com/items?itemName=BGforge.bgforge-mls
+201
View File
@@ -0,0 +1,201 @@
#include "lib.arrays.h"
// #include "define_lite.h"
variable test_suite_errors := 0;
variable test_suite_verbose := true;
#ifndef assertEquals
procedure assertEquals(variable desc, variable a, variable b) begin
if (a != b or typeof(a) != typeof(b)) then begin
display_msg("Assertion failed \""+desc+"\": "+a+" != "+b);
test_suite_errors ++;
end else if (test_suite_verbose) then begin
display_msg("Assert \""+desc+"\" ok");
end
end
procedure assertNotEquals(variable desc, variable a, variable b) begin
if (a == b) then begin
display_msg("Assertion failed \""+desc+"\": "+a+" == "+b);
test_suite_errors ++;
end else if (test_suite_verbose) then begin
display_msg("Assert \""+desc+"\" ok");
end
end
#endif
#define ARRAY_MAX_STRING (255)
#define ARRAY_MAX_SIZE (100000)
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.");
end
procedure map_enter_p_proc begin
display_msg("Starting tests");
call array_test_suite();
end
+70 -1
View File
@@ -789,6 +789,62 @@ struct CustomKarmaFolderDescription {
static std::vector<CustomKarmaFolderDescription> gCustomKarmaFolderDescriptions;
static std::vector<TownReputationEntry> gCustomTownReputationEntries;
/* Explaining characterEditorSelectedItem
0-6: Primary Stats (SPECIAL)
- 0-6 = The seven primary stats (Strength, Perception, Endurance, Charisma, Intelligence, Agility, Luck)
- Used for highlighting which SPECIAL stat is selected
7-9: Level/Experience Area
- 7 = Level display
- 8 = Experience points display
- 9 = Experience needed for next level
10-42: Folder Content Area (Perks/Karma/Kills)
- 10-42 = Items within the currently selected folder tab (perks, karma, or kills)
- 10 = First visible item in the folder
- The actual content depends on which folder is active (characterEditorWindowSelectedFolder)
- This is the range where mouse wheel scrolling is active
- When scrolling, items shift but the selection stays within this range
43-50: Status Conditions
- 43 = Hit Points (EDITOR_HIT_POINTS)
- 44 = Poisoned status (EDITOR_POISONED)
- 45 = Radiated status (EDITOR_RADIATED)
- 46 = Eye damage (EDITOR_EYE_DAMAGE)
- 47 = Crippled right arm (EDITOR_CRIPPLED_RIGHT_ARM)
- 48 = Crippled left arm (EDITOR_CRIPPLED_LEFT_ARM)
- 49 = Crippled right leg (EDITOR_CRIPPLED_RIGHT_LEG)
- 50 = Crippled left leg (EDITOR_CRIPPLED_LEFT_LEG)
51-60: Derived Stats
- 51-60 = The 10 derived stats (EDITOR_FIRST_DERIVED_STAT + EDITOR_DERIVED_STAT_*)
- Armor Class, Action Points, Carry Weight, Melee Damage, etc.
61-78: Skills
- 61-78 = The 18 skills (EDITOR_FIRST_SKILL to EDITOR_FIRST_SKILL + SKILL_COUNT)
- Small Guns, Big Guns, Energy Weapons, Unarmed, etc.
- characterEditorSelectedItem - 61 gives the actual skill index
79-81: Skill Controls
- 79 = Tag Skill button (EDITOR_TAG_SKILL)
- 80 = Skills header/button (EDITOR_SKILLS)
- 81 = Optional Traits button (EDITOR_OPTIONAL_TRAITS)
82-97: Optional Traits
- 82-97 = The 16 trait slots (EDITOR_FIRST_TRAIT to EDITOR_FIRST_TRAIT + TRAIT_COUNT)
- Fast Metabolism, Bruiser, Small Frame, etc.
- Can be arranged in 2 columns (left: 82-89, right: 90-97)
*/
// 0x431DF8
int characterEditorShow(bool isCreationMode)
{
@@ -826,7 +882,20 @@ int characterEditorShow(bool isCreationMode)
_frame_time = getTicks();
int keyCode = inputGetInput();
convertMouseWheelToArrowKey(&keyCode);
// check for mouse wheel over the "folder" area (perks/karma/kills)
if (keyCode == -1 && (mouseGetEvent() & MOUSE_EVENT_WHEEL) != 0 && !gCharacterEditorIsCreationMode && mouseHitTestInWindow(gCharacterEditorWindow, 34, 364, 314, 364 + 9 * (fontGetLineHeight() + 1))) {
int wheelX, wheelY;
mouseGetWheel(&wheelX, &wheelY);
if (wheelY > 0) { // Scroll up
characterEditorFolderViewScroll(-1);
} else if (wheelY < 0) { // Scroll down
characterEditorFolderViewScroll(1);
}
characterEditorDrawCard();
windowRefresh(gCharacterEditorWindow);
} else {
convertMouseWheelToArrowKey(&keyCode);
}
bool done = false;
if (keyCode == 500) {
+2 -2
View File
@@ -123,7 +123,7 @@ MessageList gMiscMessageList;
static void** gGameGlobalPointers = nullptr;
// 0x442580
int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int a4, int argc, char** argv)
int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int flags, int argc, char** argv)
{
char path[COMPAT_MAX_PATH];
@@ -150,7 +150,7 @@ int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int a4
messageListRepositoryInit();
programWindowSetTitle(windowTitle);
_initWindow(1, a4);
_initWindow(1, flags);
paletteInit();
const char* language = settings.system.language.c_str();
+1 -1
View File
@@ -23,7 +23,7 @@ extern int _game_user_wants_to_quit;
extern MessageList gMiscMessageList;
int gameInitWithOptions(const char* windowTitle, bool isMapper, int a3, int a4, int argc, char** argv);
int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int flags, int argc, char** argv);
void gameReset();
void gameExit();
int gameHandleKey(int eventCode, bool isInCombatMode);
+47 -10
View File
@@ -548,6 +548,8 @@ static FrmImage _redButtonNormalFrmImage;
static FrmImage _redButtonPressedFrmImage;
static FrmImage _lowerHighlightFrmImage;
static FrmImage _upperHighlightFrmImage;
static FrmImage _littleRedButtonNormalFrmImage;
static FrmImage _littleRedButtonPressedFrmImage;
static int _gdialogReset();
static void gameDialogEndLips();
@@ -623,7 +625,9 @@ static void gameDialogHighlightsInit();
static void gameDialogHighlightsExit();
static void gameDialogRedButtonsInit();
static void gameDialogLittleRedButtonsInit();
static void gameDialogRedButtonsExit();
static void gameDialogLittleRedButtonsExit();
static bool gGameDialogFix;
static bool gNumberOptions;
@@ -914,6 +918,7 @@ int _gdialogInitFromScript(int headFid, int reaction)
// CE: Fix Barter button.
gameDialogRedButtonsInit();
gameDialogLittleRedButtonsInit();
_gdCreateHeadWindow();
tickersAdd(gameDialogTicker);
@@ -966,6 +971,7 @@ int _gdialogExitFromScript()
// CE: Fix Barter button.
gameDialogRedButtonsExit();
gameDialogLittleRedButtonsExit();
fontSetCurrent(_oldFont);
@@ -3235,12 +3241,12 @@ int _gdialog_barter_create_win()
backgroundFrmImage.unlock();
// TRADE
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 41, 163, 14, 14, -1, -1, -1, KEY_LOWERCASE_M, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 40, 162, 14, 14, -1, -1, -1, KEY_LOWERCASE_M, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
if (_gdialog_buttons[0] != -1) {
buttonSetCallbacks(_gdialog_buttons[0], _gsound_med_butt_press, _gsound_med_butt_release);
// TALK
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 584, 162, 14, 14, -1, -1, -1, KEY_LOWERCASE_T, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 583, 161, 14, 14, -1, -1, -1, KEY_LOWERCASE_T, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
if (_gdialog_buttons[1] != -1) {
buttonSetCallbacks(_gdialog_buttons[1], _gsound_med_butt_press, _gsound_med_butt_release);
@@ -3407,7 +3413,7 @@ int partyMemberControlWindowInit()
partyMemberControlWindowFree();
return -1;
}
buttonSetCallbacks(_gdialog_buttons[1], _gsound_med_butt_press, _gsound_med_butt_release);
buttonSetCallbacks(_gdialog_buttons[2], _gsound_med_butt_press, _gsound_med_butt_release);
// USE BEST ARMOR
_gdialog_buttons[3] = buttonCreate(gGameDialogWindow, 235, 46, 14, 14, -1, -1, -1, KEY_LOWERCASE_A, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
@@ -3415,7 +3421,7 @@ int partyMemberControlWindowInit()
partyMemberControlWindowFree();
return -1;
}
buttonSetCallbacks(_gdialog_buttons[2], _gsound_med_butt_press, _gsound_med_butt_release);
buttonSetCallbacks(_gdialog_buttons[3], _gsound_med_butt_press, _gsound_med_butt_release);
_control_buttons_start = 4;
@@ -3884,7 +3890,7 @@ int partyMemberCustomizationWindowInit()
return -1;
}
buttonSetCallbacks(_gdialog_buttons[index], _gsound_med_butt_press, _gsound_med_butt_release);
buttonSetCallbacks(_gdialog_buttons[optionButton], _gsound_med_butt_press, _gsound_med_butt_release);
}
_custom_current_selected[PARTY_MEMBER_CUSTOMIZATION_OPTION_AREA_ATTACK_MODE] = aiGetAreaAttackMode(gGameDialogSpeaker);
@@ -4119,17 +4125,23 @@ int _gdCustomSelect(int a1)
backgroundFrmImage.unlock();
int btn1 = buttonCreate(win, 70, 164, 14, 14, -1, -1, -1, KEY_RETURN, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
int btn1 = buttonCreate(win, 70, 164, _littleRedButtonNormalFrmImage.getWidth(), _littleRedButtonNormalFrmImage.getHeight(), -1, -1, -1, 500, _littleRedButtonNormalFrmImage.getData(), _littleRedButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
if (btn1 == -1) {
windowDestroy(win);
return -1;
}
if (btn1 != -1) {
buttonSetCallbacks(btn1, _gsound_red_butt_press, _gsound_red_butt_release);
}
int btn2 = buttonCreate(win, 176, 163, 14, 14, -1, -1, -1, KEY_ESCAPE, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
int btn2 = buttonCreate(win, 176, 163, _littleRedButtonNormalFrmImage.getWidth(), _littleRedButtonNormalFrmImage.getHeight(), -1, -1, -1, KEY_ESCAPE, _littleRedButtonNormalFrmImage.getData(), _littleRedButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
if (btn2 == -1) {
windowDestroy(win);
return -1;
}
if (btn2 != -1) {
buttonSetCallbacks(btn2, _gsound_red_butt_press, _gsound_red_butt_release);
}
fontSetCurrent(103);
@@ -4169,10 +4181,13 @@ int _gdCustomSelect(int a1)
break;
}
if (keyCode == KEY_RETURN) {
if (keyCode == KEY_RETURN || keyCode == 500) {
STRUCT_5189E4* ptr = &(_custom_settings[a1][value]);
_custom_current_selected[a1] = value;
_gdCustomUpdateSetting(a1, ptr->value);
if (keyCode != 500) {
soundPlayFile("ib1p1xx1");
}
done = true;
} else if (keyCode == KEY_ESCAPE) {
done = true;
@@ -4346,6 +4361,9 @@ int _gdialog_window_create()
// TODO: Not sure about offsets.
blitBufferToBuffer(bgWindowBuf + screenWidth * (GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len), screenWidth, _dialogue_subwin_len, screenWidth, windowBuf, screenWidth);
// BARTER/TRADE - button moved here to set above background window
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 41, 14, 14, -1, -1, -1, -1, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
if (_dialogue_just_started) {
windowRefresh(gGameDialogBackgroundWindow);
_gdialog_scroll_subwin(gGameDialogWindow, true, backgroundFrmData, windowBuf, nullptr, _dialogue_subwin_len, true);
@@ -4354,8 +4372,6 @@ int _gdialog_window_create()
_gdialog_scroll_subwin(gGameDialogWindow, true, backgroundFrmData, windowBuf, nullptr, _dialogue_subwin_len, false);
}
// BARTER/TRADE
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 41, 14, 14, -1, -1, -1, -1, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
if (_gdialog_buttons[0] != -1) {
buttonSetMouseCallbacks(_gdialog_buttons[0], nullptr, nullptr, nullptr, gameDialogBarterButtonUpMouseUp);
buttonSetCallbacks(_gdialog_buttons[0], _gsound_med_butt_press, _gsound_med_butt_release);
@@ -4724,6 +4740,27 @@ static void gameDialogRedButtonsInit()
}
}
static void gameDialogLittleRedButtonsInit()
{
// di_rdbt2.frm - dialog red button up
int normalFid = buildFid(OBJ_TYPE_INTERFACE, 8, 0, 0, 0);
if (!_littleRedButtonNormalFrmImage.lock(normalFid)) {
gameDialogLittleRedButtonsExit();
}
// di_rdbt1.frm - dialog red button down
int pressedFid = buildFid(OBJ_TYPE_INTERFACE, 9, 0, 0, 0);
if (!_littleRedButtonPressedFrmImage.lock(pressedFid)) {
gameDialogLittleRedButtonsExit();
}
}
static void gameDialogLittleRedButtonsExit()
{
_littleRedButtonNormalFrmImage.unlock();
_littleRedButtonPressedFrmImage.unlock();
}
static void gameDialogRedButtonsExit()
{
_redButtonNormalFrmImage.unlock();
+7 -7
View File
@@ -352,20 +352,20 @@ void takeScreenshot()
return;
}
WINDOWDRAWINGPROC v0 = _scr_blit;
WINDOWDRAWINGPROC old_src = _scr_blit;
_scr_blit = screenshotBlitter;
WINDOWDRAWINGPROC v2 = _mouse_blit;
WINDOWDRAWINGPROC old_mouse = _mouse_blit;
_mouse_blit = screenshotBlitter;
WindowDrawingProc2* v1 = _mouse_blit_trans;
WindowDrawingProc2* old_mouse_trans = _mouse_blit_trans;
_mouse_blit_trans = nullptr;
windowRefreshAll(&_scr_size);
_mouse_blit_trans = v1;
_mouse_blit = v2;
_scr_blit = v0;
_mouse_blit_trans = old_mouse_trans;
_mouse_blit = old_mouse;
_scr_blit = old_src;
unsigned char* palette = _getSystemPalette();
gScreenshotHandler(width, height, gScreenshotBuffer, palette);
@@ -373,7 +373,7 @@ void takeScreenshot()
}
// 0x4C8FF0
static void screenshotBlitter(unsigned char* src, int srcPitch, int a3, int srcX, int srcY, int width, int height, int destX, int destY)
static void screenshotBlitter(unsigned char* src, int srcPitch, int _, int srcX, int srcY, int width, int height, int destX, int destY)
{
int destWidth = _scr_size.right - _scr_size.left + 1;
blitBufferToBuffer(src + srcPitch * srcY + srcX, width, height, srcPitch, gScreenshotBuffer + destWidth * destY + destX, destWidth);
+99 -125
View File
@@ -269,7 +269,7 @@ static void inventoryWindowOpenContextMenu(int eventCode, int inventoryWindowTyp
static InventoryMoveResult _move_inventory(Object* item, int slotIndex, Object* targetObj, bool isPlanting);
static int _barter_compute_value(Object* dude, Object* npc);
static int _barter_attempt_transaction(Object* dude, Object* offerTable, Object* npc, Object* barterTable);
static int _barter_get_quantity_moved_items(Object* item, int maxQuantity, bool fromPlayer, bool fromInventory);
static int _barter_get_quantity_moved_items(Object* item, int maxQuantity, bool fromPlayer, bool fromInventory, bool immediate);
static void _barter_move_inventory(Object* item, int quantity, int slotIndex, int indexOffset, Object* npc, Object* sourceTable, bool fromDude);
static void _barter_move_from_table_inventory(Object* item, int quantity, int slotIndex, Object* npc, Object* sourceTable, bool fromDude);
static void inventoryWindowRenderInnerInventories(int win, Object* leftTable, Object* rightTable, int draggedSlotIndex);
@@ -281,6 +281,8 @@ static void _draw_amount(int value, int inventoryWindowType);
static int inventoryQuantitySelect(int inventoryWindowType, Object* item, int maximum, int defaultValue = 1);
static int inventoryQuantityWindowInit(int inventoryWindowType, Object* item);
static int inventoryQuantityWindowFree(int inventoryWindowType);
static bool _ctrl_pressed();
static void _drag_item_loop(Object* item, bool immediate);
// 0x46E6D0
static const int gSummaryStats[7] = {
@@ -464,7 +466,7 @@ static Object* _ptable;
static InventoryPrintItemDescriptionHandler* gInventoryPrintItemDescriptionHandler;
// 0x59E93C
static int _im_value;
static int _im_value; // "keyCode" corresponding to an inventory item "button", or -1 if nothing
// 0x59E940
static int gInventoryCursor;
@@ -2311,7 +2313,8 @@ static void _inven_pickup(int buttonCode, int indexOffset)
break;
}
if (itemIndex == -1 || _pud->items[indexOffset + itemIndex].quantity <= 1) {
// fix for disappearing/not disappearing inventory items
if (itemIndex == -1 || _pud->items[_pud->length - (itemIndex + indexOffset + 1)].quantity <= 1) { // slots
unsigned char* windowBuffer = windowGetBuffer(gInventoryWindow);
if (gInventoryRightHandItem != gInventoryLeftHandItem || item != gInventoryLeftHandItem) {
int height;
@@ -2359,42 +2362,21 @@ static void _inven_pickup(int buttonCode, int indexOffset)
_display_inventory(indexOffset, itemIndex, INVENTORY_WINDOW_TYPE_NORMAL);
}
FrmImage itemInventoryFrmImage;
int itemInventoryFid = itemGetInventoryFid(item);
if (itemInventoryFrmImage.lock(itemInventoryFid)) {
int width = itemInventoryFrmImage.getWidth();
int height = itemInventoryFrmImage.getHeight();
unsigned char* data = itemInventoryFrmImage.getData();
mouseSetFrame(data, width, height, width, width / 2, height / 2, 0);
soundPlayFile("ipickup1");
}
if (itemInHand != nullptr) {
_inven_update_lighting(nullptr);
}
do {
sharedFpsLimiter.mark();
// SFALL: allow ctrl-click to unequip
bool immediate = itemIndex == -1 && _ctrl_pressed();
_drag_item_loop(item, immediate);
inputGetInput();
_display_body(-1, INVENTORY_WINDOW_TYPE_NORMAL);
renderPresent();
sharedFpsLimiter.throttle();
} while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0);
if (itemInventoryFrmImage.isLocked()) {
itemInventoryFrmImage.unlock();
soundPlayFile("iputdown");
}
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_SCROLLER_X, INVENTORY_SCROLLER_Y, INVENTORY_SCROLLER_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_SCROLLER_Y)) {
if (immediate || mouseHitTestInWindow(gInventoryWindow, INVENTORY_SCROLLER_X, INVENTORY_SCROLLER_Y, INVENTORY_SCROLLER_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_SCROLLER_Y)) {
int x;
int y;
mouseGetPositionInWindow(gInventoryWindow, &x, &y);
int targetIndex = (y - 39) / INVENTORY_SLOT_HEIGHT + indexOffset;
if (targetIndex < _pud->length) {
if (!immediate && targetIndex < _pud->length) {
Object* targetItem = _pud->items[targetIndex].item;
if (targetItem != item) {
// Dropping item on top of another item.
@@ -2410,7 +2392,7 @@ static void _inven_pickup(int buttonCode, int indexOffset)
}
}
if (itemIndex == -1) {
if (immediate || itemIndex == -1) {
// TODO: Holy shit, needs refactoring.
*itemSlot = nullptr;
if (itemAdd(_inven_dude, item, 1)) {
@@ -4273,7 +4255,7 @@ int inventoryOpenLooting(Object* looter, Object* target)
break;
}
if (keyCode == KEY_UPPERCASE_A) {
if (keyCode == KEY_UPPERCASE_A || keyCode == KEY_LOWERCASE_A) {
if (!_gIsSteal) {
int maxCarryWeight = critterGetStat(looter, STAT_CARRY_WEIGHT);
int currentWeight = objectGetInventoryWeight(looter);
@@ -4527,6 +4509,7 @@ int inventoryOpenStealing(Object* thief, Object* target)
}
// 0x474708
// note: this is looting and stealing, not the inventory screen
static InventoryMoveResult _move_inventory(Object* item, int slotIndex, Object* targetObj, bool isPlanting)
{
bool needRefresh = true;
@@ -4576,40 +4559,17 @@ static InventoryMoveResult _move_inventory(Object* item, int slotIndex, Object*
windowRefreshRect(gInventoryWindow, &rect);
}
FrmImage itemInventoryFrmImage;
int itemInventoryFid = itemGetInventoryFid(item);
if (itemInventoryFrmImage.lock(itemInventoryFid)) {
int width = itemInventoryFrmImage.getWidth();
int height = itemInventoryFrmImage.getHeight();
unsigned char* data = itemInventoryFrmImage.getData();
mouseSetFrame(data, width, height, width, width / 2, height / 2, 0);
soundPlayFile("ipickup1");
}
do {
sharedFpsLimiter.mark();
inputGetInput();
renderPresent();
sharedFpsLimiter.throttle();
} while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0);
if (itemInventoryFrmImage.isLocked()) {
itemInventoryFrmImage.unlock();
soundPlayFile("iputdown");
}
bool immediate = _ctrl_pressed();
_drag_item_loop(item, immediate);
InventoryMoveResult result = INVENTORY_MOVE_RESULT_FAILED;
MessageListItem messageListItem;
if (isPlanting) {
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_LOOT_RIGHT_SCROLLER_X, INVENTORY_LOOT_RIGHT_SCROLLER_Y, INVENTORY_LOOT_RIGHT_SCROLLER_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_LOOT_RIGHT_SCROLLER_Y)) {
int quantityToMove;
if (quantity > 1) {
if (immediate || mouseHitTestInWindow(gInventoryWindow, INVENTORY_LOOT_RIGHT_SCROLLER_X, INVENTORY_LOOT_RIGHT_SCROLLER_Y, INVENTORY_LOOT_RIGHT_SCROLLER_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_LOOT_RIGHT_SCROLLER_Y)) {
int quantityToMove = quantity;
if (quantity > 1 && !immediate) {
quantityToMove = inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, item, quantity);
} else {
quantityToMove = 1;
}
if (quantityToMove != -1) {
@@ -4633,12 +4593,10 @@ static InventoryMoveResult _move_inventory(Object* item, int slotIndex, Object*
}
}
} else {
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_LOOT_LEFT_SCROLLER_X, INVENTORY_LOOT_LEFT_SCROLLER_Y, INVENTORY_LOOT_LEFT_SCROLLER_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_LOOT_LEFT_SCROLLER_Y)) {
int quantityToMove;
if (quantity > 1) {
if (immediate || mouseHitTestInWindow(gInventoryWindow, INVENTORY_LOOT_LEFT_SCROLLER_X, INVENTORY_LOOT_LEFT_SCROLLER_Y, INVENTORY_LOOT_LEFT_SCROLLER_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_LOOT_LEFT_SCROLLER_Y)) {
int quantityToMove = quantity;
if (quantity > 1 && !immediate) {
quantityToMove = inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, item, quantity);
} else {
quantityToMove = 1;
}
if (quantityToMove != -1) {
@@ -4766,7 +4724,7 @@ static int _barter_attempt_transaction(Object* dude, Object* offerTable, Object*
return 0;
}
static int _barter_get_quantity_moved_items(Object* item, int maxQuantity, bool fromPlayer, bool fromInventory)
static int _barter_get_quantity_moved_items(Object* item, int maxQuantity, bool fromPlayer, bool fromInventory, bool immediate)
{
if (maxQuantity <= 1) {
return maxQuantity;
@@ -4782,11 +4740,54 @@ static int _barter_get_quantity_moved_items(Object* item, int maxQuantity, bool
if ((balance < 0 && fromInventory) || (balance > 0 && !fromInventory)) {
suggestedValue = std::min(std::abs(balance), maxQuantity);
if (immediate) {
return suggestedValue;
}
}
}
if (immediate) {
return maxQuantity;
}
return inventoryQuantitySelect(INVENTORY_WINDOW_TYPE_MOVE_ITEMS, item, maxQuantity, suggestedValue);
}
// clicked on an inventory in preparation of dragging or immediate transfer
static void _drag_item_loop(Object* item, bool immediate)
{
if (immediate) {
soundPlayFile("iputdown");
// prevent item look from occuring after immediate move
_im_value = -1;
return;
}
FrmImage itemInventoryFrmImage;
int itemInventoryFid = itemGetInventoryFid(item);
if (itemInventoryFrmImage.lock(itemInventoryFid)) {
int width = itemInventoryFrmImage.getWidth();
int height = itemInventoryFrmImage.getHeight();
unsigned char* data = itemInventoryFrmImage.getData();
mouseSetFrame(data, width, height, width, width / 2, height / 2, 0);
soundPlayFile("ipickup1");
}
do {
sharedFpsLimiter.mark();
inputGetInput();
renderPresent();
sharedFpsLimiter.throttle();
} while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0);
if (itemInventoryFrmImage.isLocked()) {
itemInventoryFrmImage.unlock();
soundPlayFile("iputdown");
}
}
// 0x474DAC
static void _barter_move_inventory(Object* item, int quantity, int slotIndex, int indexOffset, Object* npc, Object* sourceTable, bool fromDude)
{
@@ -4817,35 +4818,14 @@ static void _barter_move_inventory(Object* item, int quantity, int slotIndex, in
windowRefreshRect(gInventoryWindow, &rect);
}
FrmImage itemInventoryFrmImage;
int itemInventoryFid = itemGetInventoryFid(item);
if (itemInventoryFrmImage.lock(itemInventoryFid)) {
int width = itemInventoryFrmImage.getWidth();
int height = itemInventoryFrmImage.getHeight();
unsigned char* data = itemInventoryFrmImage.getData();
mouseSetFrame(data, width, height, width, width / 2, height / 2, 0);
soundPlayFile("ipickup1");
}
do {
sharedFpsLimiter.mark();
inputGetInput();
renderPresent();
sharedFpsLimiter.throttle();
} while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0);
if (itemInventoryFrmImage.isLocked()) {
itemInventoryFrmImage.unlock();
soundPlayFile("iputdown");
}
bool immediate = _ctrl_pressed();
_drag_item_loop(item, immediate);
MessageListItem messageListItem;
if (fromDude) {
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_X, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_Y)) {
int quantityToMove = _barter_get_quantity_moved_items(item, quantity, true, true);
if (immediate || mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_X, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_INNER_LEFT_SCROLLER_TRACKING_Y)) {
int quantityToMove = _barter_get_quantity_moved_items(item, quantity, true, true, immediate);
if (quantityToMove != -1) {
if (itemMoveForce(_inven_dude, sourceTable, item, quantityToMove) == -1) {
// There is no space left for that item.
@@ -4857,8 +4837,8 @@ static void _barter_move_inventory(Object* item, int quantity, int slotIndex, in
}
}
} else {
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_X, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_Y)) {
int quantityToMove = _barter_get_quantity_moved_items(item, quantity, false, true);
if (immediate || mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_X, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_INNER_RIGHT_SCROLLER_TRACKING_Y)) {
int quantityToMove = _barter_get_quantity_moved_items(item, quantity, false, true, immediate);
if (quantityToMove != -1) {
if (itemMoveForce(npc, sourceTable, item, quantityToMove) == -1) {
// You cannot pick that up. You are at your maximum weight capacity.
@@ -4904,35 +4884,14 @@ static void _barter_move_from_table_inventory(Object* item, int quantity, int sl
windowRefreshRect(gInventoryWindow, &rect);
}
FrmImage itemInventoryFrmImage;
int itemInventoryFid = itemGetInventoryFid(item);
if (itemInventoryFrmImage.lock(itemInventoryFid)) {
int width = itemInventoryFrmImage.getWidth();
int height = itemInventoryFrmImage.getHeight();
unsigned char* data = itemInventoryFrmImage.getData();
mouseSetFrame(data, width, height, width, width / 2, height / 2, 0);
soundPlayFile("ipickup1");
}
do {
sharedFpsLimiter.mark();
inputGetInput();
renderPresent();
sharedFpsLimiter.throttle();
} while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_REPEAT) != 0);
if (itemInventoryFrmImage.isLocked()) {
itemInventoryFrmImage.unlock();
soundPlayFile("iputdown");
}
bool immediate = _ctrl_pressed();
_drag_item_loop(item, immediate);
MessageListItem messageListItem;
if (fromDude) {
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_X, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_Y)) {
int quantityToMove = _barter_get_quantity_moved_items(item, quantity, true, false);
if (immediate || mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_X, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_LEFT_SCROLLER_TRACKING_Y)) {
int quantityToMove = _barter_get_quantity_moved_items(item, quantity, true, false, immediate);
if (quantityToMove != -1) {
if (itemMoveForce(sourceTable, _inven_dude, item, quantityToMove) == -1) {
// There is no space left for that item.
@@ -4944,8 +4903,8 @@ static void _barter_move_from_table_inventory(Object* item, int quantity, int sl
}
}
} else {
if (mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_X, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_Y)) {
int quantityToMove = _barter_get_quantity_moved_items(item, quantity, false, false);
if (immediate || mouseHitTestInWindow(gInventoryWindow, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_X, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_Y, INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_MAX_X, INVENTORY_SLOT_HEIGHT * gInventorySlotsCount + INVENTORY_TRADE_RIGHT_SCROLLER_TRACKING_Y)) {
int quantityToMove = _barter_get_quantity_moved_items(item, quantity, false, false, immediate);
if (quantityToMove != -1) {
if (itemMoveForce(sourceTable, npc, item, quantityToMove) == -1) {
// You cannot pick that up. You are at your maximum weight capacity.
@@ -5053,6 +5012,12 @@ static void inventoryWindowRenderInnerInventories(int win, Object* leftTable, Ob
fontSetCurrent(oldFont);
}
static bool _ctrl_pressed()
{
const Uint8* keyboardState = SDL_GetKeyboardState(nullptr);
return keyboardState[SDL_SCANCODE_LCTRL] || keyboardState[SDL_SCANCODE_RCTRL];
}
// 0x4757F0
void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object* bartererTable, int barterMod)
{
@@ -5150,11 +5115,13 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
_barter_mod = barterMod + modifier;
if (keyCode == KEY_LOWERCASE_T || modifier <= -30) {
// T == return to talk
itemMoveAll(bartererTable, barterer);
itemMoveAll(playerTable, gDude);
_barter_end_to_talk_to();
break;
} else if (keyCode == KEY_LOWERCASE_M) {
// M == attempt offer
if (playerTable->data.inventory.length != 0 || _btable->data.inventory.length != 0) {
if (_barter_attempt_transaction(_inven_dude, playerTable, barterer, bartererTable) == 0) {
_display_target_inventory(_target_stack_offset[_target_curr_stack], -1, _target_pud, INVENTORY_WINDOW_TYPE_TRADE);
@@ -5228,6 +5195,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
inventoryWindowOpenContextMenu(keyCode, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, playerTable, nullptr, -1);
} else {
// player inventory
int slotIndex = keyCode - 1000;
if (slotIndex + _stack_offset[_curr_stack] < _pud->length) {
int offset = _stack_offset[_curr_stack];
@@ -5241,6 +5209,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
keyCode = -1;
} else if (keyCode >= 2000 && keyCode <= 2000 + gInventorySlotsCount) {
// merchant inventory
if (gInventoryCursor == INVENTORY_WINDOW_CURSOR_ARROW) {
inventoryWindowOpenContextMenu(keyCode, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, nullptr, bartererTable, -1);
@@ -5258,6 +5227,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
keyCode = -1;
} else if (keyCode >= 2300 && keyCode <= 2300 + gInventorySlotsCount) {
// player table (offer)
if (gInventoryCursor == INVENTORY_WINDOW_CURSOR_ARROW) {
inventoryWindowOpenContextMenu(keyCode, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, playerTable, nullptr, -1);
@@ -5274,6 +5244,7 @@ void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object*
keyCode = -1;
} else if (keyCode >= 2400 && keyCode <= 2400 + gInventorySlotsCount) {
// merchant table (offer)
if (gInventoryCursor == INVENTORY_WINDOW_CURSOR_ARROW) {
inventoryWindowOpenContextMenu(keyCode, INVENTORY_WINDOW_TYPE_TRADE);
inventoryWindowRenderInnerInventories(win, nullptr, bartererTable, -1);
@@ -5638,16 +5609,19 @@ static int inventoryQuantitySelect(int inventoryWindowType, Object* item, int ma
return -1;
}
if (keyCode == KEY_RETURN) {
if (keyCode == KEY_RETURN || keyCode == 500) {
if (value >= min && value <= max) {
if (inventoryWindowType != INVENTORY_WINDOW_TYPE_SET_TIMER || value % 10 == 0) {
soundPlayFile("ib1p1xx1");
break;
if (keyCode != 500) {
soundPlayFile("ib1p1xx1");
}
}
} else {
soundPlayFile("iisxxxx1");
}
break;
soundPlayFile("iisxxxx1");
} else if (keyCode == 5000) {
} else if (keyCode == 5000 || keyCode == KEY_LOWERCASE_A) {
isTyping = false;
value = max;
_draw_amount(value, inventoryWindowType);
@@ -5907,7 +5881,7 @@ static int inventoryQuantityWindowInit(int inventoryWindowType, Object* item)
-1,
-1,
-1,
KEY_RETURN,
500,
_moveFrmImages[4].getData(),
_moveFrmImages[5].getData(),
nullptr,
+6 -6
View File
@@ -781,17 +781,17 @@ int _movieRun(int win, char* filePath)
}
// 0x487B1C
int _movieRunRect(int win, char* filePath, int a3, int a4, int a5, int a6)
int _movieRunRect(int win, char* filePath, int x, int y, int w, int h)
{
if (_running) {
return 1;
}
_movieX = a3;
_movieY = a4;
_movieOffset = a3 + a4 * windowGetWidth(win);
_movieW = a5;
_movieH = a6;
_movieX = x;
_movieY = y;
_movieOffset = x + y * windowGetWidth(win);
_movieW = w;
_movieH = h;
_movieSubRectFlag = 1;
return _movieStart(win, filePath);
+2 -2
View File
@@ -28,11 +28,11 @@ typedef int(MovieBlitFunc)(int win, unsigned char* data, int width, int height,
void movieInit();
void movieExit();
void _movieStop();
int movieSetFlags(int a1);
int movieSetFlags(int flags);
void _movieSetPaletteFunc(MovieSetPaletteEntriesProc* proc);
void movieSetPaletteProc(MovieSetPaletteProc* proc);
int _movieRun(int win, char* filePath);
int _movieRunRect(int win, char* filePath, int a3, int a4, int a5, int a6);
int _movieRunRect(int win, char* filePath, int x, int y, int w, int h);
void movieSetBuildSubtitleFilePathProc(MovieBuildSubtitleFilePathProc* proc);
void movieSetVolume(int volume);
void _movieUpdate();
+3 -2
View File
@@ -687,8 +687,9 @@ static int pipboyWindowInit(int intent)
buttonSetCallbacks(alarmButton, _gsound_med_butt_press, _gsound_med_butt_release);
}
int y = 341;
int y = 340;
int eventCode = 500;
int yOffsets[] = { 27, 27, 29, 25, 27 }; // handles slighlty misaligned buttons on background
for (int index = 0; index < 5; index += 1) {
if (index != 1) {
int btn = buttonCreate(gPipboyWindow,
@@ -711,7 +712,7 @@ static int pipboyWindowInit(int intent)
eventCode += 1;
}
y += 27;
y += yOffsets[index];
}
if (intent == PIPBOY_OPEN_INTENT_REST) {
+1 -1
View File
@@ -80,7 +80,7 @@ namespace fallout {
#define SFALL_CONFIG_PIPBOY_AVAILABLE_AT_GAMESTART "PipBoyAvailableAtGameStart"
#define SFALL_CONFIG_USE_WALK_DISTANCE "UseWalkDistance"
#define SFALL_CONFIG_AUTO_OPEN_DOORS "AutoOpenDoors"
#define SFALL_CONFIG_GAPLESS_MUSIC "GaplessMusic"
#define SFALL_CONFIG_GAPLESS_MUSIC "GaplessMusic" // note: this isn't an sfall config
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1
#define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3
+1 -1
View File
@@ -298,7 +298,7 @@ unsigned char* directDrawGetPalette()
}
// 0x4CB850
void _GNW95_ShowRect(unsigned char* src, int srcPitch, int a3, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY)
void _GNW95_ShowRect(unsigned char* src, int srcPitch, int _, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY)
{
blitBufferToBuffer(src + srcPitch * srcY + srcX, srcWidth, srcHeight, srcPitch, (unsigned char*)gSdlSurface->pixels + gSdlSurface->pitch * destY + destX, gSdlSurface->pitch);

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