Commit Graph
38 Commits
Author SHA1 Message Date
Matthew Duggan 9220e7530d DGDS: Update comment 2025-03-04 20:56:04 +11:00
Matthew Duggan af7636fb19 DGDS: Log segment name if available 2025-03-02 08:02:31 +11:00
Matthew Duggan 4742182e34 DGDS: Fix Willy Beamish rendering at bar
More ADS skip logic fixes.

Also stop loading so many ADS scripts on game load - we only need the active
one.
2025-01-04 12:30:15 +11:00
Matthew Duggan 5e1d3d69bc DGDS: Add workaround for disappearing cola vendor in Willy Beamish 2025-01-04 12:30:15 +11:00
Matthew Duggan b47874294c DGDS: Fix skipping nested if ADS blocks using 0x13C1
This fixes rendering of Willy as he's running from the babysitter, and probably
other random graphical glitches I've seen in the house.
2025-01-04 12:30:15 +11:00
Matthew Duggan ec271639bb DGDS: Slight compatibility fix for unknown sequences
It's possible nothing ever relies on this behavior, but it's closer to the
originals.
2025-01-04 12:30:15 +11:00
Matthew Duggan 14e119bb78 DGDS: Misc fixes for Willy Beamish
* Play sample should be one-shot (don't replay every frame)
* TTM op 0020 should save to background differently (fixes double-drawing)
* Disabled areas still change mouse cursor and hold clicks until enabled,
  properly fixes eg exiting detention at the start
* Fix the way "used" sequences are calculated so Willy can enter his house,
  removing the previous hack
* Refactor scene condition check to separate file
* Small const correctness improvements
2024-12-30 20:04:15 +11:00
Matthew Duggan e7a181c26a DGDS: More Willy Beamish fixes
* Hook up ADS variable globals so correct scripts can run
* Hack "running" status of scripts so that delayed is not running
2024-12-27 07:32:24 +11:00
Matthew Duggan 0af6afc963 DGDS: Name run type 1 more usefully 2024-12-27 07:32:24 +11:00
Matthew Duggan dd82dd285c DGDS: Start implementation of willy-beamish ADS opcodes 2024-12-24 14:08:42 +11:00
Matthew Duggan b673c07115 DGDS: Fix swapped buffers in TTM 0xB606 operation
The background and composition buffers were the wrong way around.  This fixes
various black backgrounds that were seen during the intro and start of Willy
Beamish.
2024-11-23 11:12:02 +11:00
Filippos Karapetis 94403bd3a9 DGDS: Raise debuglevel of all debug statements to at least 1
This reduces the chatty debug output, which isn't of any use to
regular users
2024-11-16 18:44:46 +02:00
Matthew Duggan 4620c93904 DGDS: Free Shape TTM op is one-shot in Willy Beamish
This fixes the intro cinematic after it zooms in on Willy and his opponent.
The sequence goes something like:

Frame N
FREE SHAPE
SELECT SHAPE
LOAD SHAPE

Frame N+1
DRAW BMP

The first frame is executed multiple times.  If LOAD is one-shot but FREE is
not, then it frees the image the second time and does not reload it.
2024-11-08 20:03:48 +11:00
Matthew Duggan 2e9d97ed0f DGDS: Use frame ms consistently for checks
Some game timing events are based on ms elapsed, but we were just getting the
current ms when it was evaluated.  This was not very consistent and could
potentially lead to weird problems, although in practice they were unlikely

Record the elapsed ms at the start of each frame so we can use the same
comparison point in every operation.
2024-11-08 20:03:48 +11:00
Matthew Duggan ef4b64f0ac DGDS: Reduce logging verbosity a bit 2024-11-07 09:35:01 +11:00
Matthew Duggan d04aaf45c0 DGDS: Better document unimplemented ADS codes 2024-11-06 16:53:34 +11:00
Matthew Duggan bd1489efb2 DGDS: Also define "finished" as not running for HoC+
Although RotD only checks against a sequence being Stopped for IF_NOT_RUNNING,
from HoC onward the check also included Finished as not running.

This fixes flashing characters in Willy Beamish.
2024-11-06 08:09:42 +11:00
Matthew Duggan d2b7ddc01e DGDS: Fix compiler warning 2024-11-03 21:48:56 +11:00
Matthew Duggan 53c1621408 DGDS: Finally really actually fix ADS exeuction order
The underlying issue was that we tracked used sequences for each ADS segment
using sequence pointers, but the 0x4000 and 0x4010 ADS opcodes re-arranged the
array of sequences.  Because arrays don't get re-allocated much this by chance
left the usage pointers valid but now pointing to the wrong sequence, so the
correct sequences were not started and stopped after a re-order operation.

Replaced the array of sequence objects and the used sequence tracker with
shared pointers so we can reorder the sequences without breaking the usage
pointers.

The tap and coat rendering in RotD now both work right and so does the
bar scroll in HoC.
2024-11-03 08:36:25 +11:00
Matthew Duggan 5b162cede1 DGDS: Flop back to previous ADS orderring
This is a partial revert of 4bb1410079 and
36fe1cdff4.  I can't seem to make up my mind
here, but after looking at Ghidra for a really long time I'm now 99% sure that
0x4000 is move to back and 0x4010 is move to front.  You can tell because the
0x4000 function in the original finishes with setting the next pointer of the
found element to 0.

I confirmed this in both the RotD and HoC Ghidra outputs.

This re-breaks the tap in the apartment in RotD, I will need to fix that again.

On the up-side, it fixes the scroll left/right in the bar at the start of HoC.
2024-11-03 08:36:25 +11:00
Matthew Duggan 232a44585f DGDS: Clean up debug messages slightly. PVS-Studio V547 2024-10-30 14:08:36 +11:00
Matthew Duggan 01a38de001 DGDS: Fix pointer validation and unused param PVS-Studio V595, V763. 2024-10-29 17:51:58 +11:00
Matthew Duggan 4bb1410079 DGDS: Fix ADS move ops again
These move operations appear to actually work off the index of the sequence
within the list, not the sequence number.  This finally fixes the drawing of
the clothes in Blade's apartment without breaking the tap.

Still need to test through the games to make sure but I think this will now
give the correct execution order.
2024-10-21 15:27:15 +11:00
Matthew Duggan 36fe1cdff4 DGDS: Fix ADS execution order again
Closer inspection shows the "move to front" and "move to back" ADS ops were the
wrong way around.

Unfortunately this breaks the rendering a bit - blade's shirt flashes on the
floor of the apartment at the start of dragon.

However, it's more correct and fixes other things - eg, turning off the tap in
the apartment.  The rendering problem will need a different fix.
2024-10-16 19:52:19 +11:00
Matthew Duggan d7a6701a66 DGDS: Reduce unneeded hex numbers in dragon arcade code 2024-09-22 10:01:25 +03:00
Matthew Duggan c80a5b4a28 DGDS: Dragon sequence almost complete 2024-09-22 10:01:25 +03:00
Hubert Maier ef3b6c5fbb JANITORIAL: DGDS: Fix typos in comments/warnings 2024-08-01 20:16:37 +03:00
Matthew Duggan e9f7121d7a DGDS: Implement HoC shell game 2024-07-26 21:12:08 +10:00
Matthew Duggan 61ab4902fb DGDS: Fix willy scene and dialog parsing slightly
First scene now sort of works, still quite buggy.
2024-07-08 20:54:00 +10:00
Matthew Duggan ca0fe5567f DGDS: Fix ADS logic slightly
Skipping a nested IF previously executed the ELSE branch.  This could be
observed in the China intro sequence with too many scripts starting at once.
2024-07-03 09:12:09 +10:00
Matthew Duggan 7a77af7160 DGDS: Fix many small issues identified by Coverity 2024-07-01 19:32:57 +10:00
Matthew Duggan a80ea4c525 DGDS: Implement more required features for Willy Beamish
Added ttm 'gosub' instruction and scaled blit support.
2024-06-30 22:49:18 +03:00
Matthew Duggan 5f63c5b1af DGDS: Fix parsing for Willy Beamish
The game now starts to play the intro.  Still a few new unknown values in the
various structures.
2024-06-30 22:49:18 +03:00
Matthew Duggan b874625c90 DGDS: Small fixes for non-interactive demos 2024-06-30 22:49:18 +03:00
Matthew Duggan fec21fa8f3 DGDS: Small cleanups to run non-interactive demos 2024-06-30 22:49:18 +03:00
Matthew Duggan 50522d6567 DGDS: Fix rendering on game load 2024-06-30 22:49:18 +03:00
Matthew Duggan 11c3480ffe DGDS: Fix a few small game interaction bugs 2024-06-30 22:49:18 +03:00
Matthew Duggan 15f8a90b31 DGDS: Refactor to split into smaller files
Split TTM and ADS logic into their own files, and separate palette management
from image loading.

Also refactor scene types a bit to be more objecty.
2024-06-30 22:49:18 +03:00