Commit graph

180 commits

Author SHA1 Message Date
Filippos Karapetis
d8eb52a2cb DGDS: Clean up includes 2025-03-10 18:53:20 +02:00
Matthew Duggan
957e4a0cd7 DGDS: Multiple mouse fixes to match original
This changes the mouse behavior to better match the original games.

* Left-click "use" should only happen on a short click (mouse button goes down
  and up within a few frames) - longer clicks should always do "pick up"
  operation.
* Right-click "look" should only happen on short clicks, longer right button
  should start targetting mode
* Both-click should operate on all areas under the mouse, ignoring their
  conditions

This fixes #15774 and #15782, and also fixes eg Rise of the Dragon trying to
fire the gun in Blade's apartment.
2025-03-09 14:45:31 +11:00
Matthew Duggan
3082cabc0c DGDS: Avoid crash from dialogs being reallocated
When we dynamically load dialog data it's possible for the list to be
reallocated during resize.  If we were also executing operations from one of
the reallocated dialogs, it would crash when accessing that pointer again.

Switch the dialog data to a List so it will not be reallocated when loading
more data.

This fixes #15781
2025-03-06 17:18:25 +11:00
Matthew Duggan
452b5989ff DGDS: Fix interpretation of text speed setting
* The inversion (9 - value) was being applied twice, reversing
  the resulting delay
* The delay in the dialog data should be doubled before calculating delay
  millis
* The default setting should be 5

This fixes #15771
2025-03-04 20:55:55 +11:00
Matthew Duggan
d93ff33845 DGDS: Small fixes for Willy Beamish head rendering
Correct offset to render location and flipping to be more like original.
2025-03-02 08:02:31 +11:00
Matthew Duggan
800f291143 DGDS: Hold open "head" dialogs with no sound until they are closed
This is used for the Willy Beamish blueprints.  Don't close until needed if no
sound is present.
2025-03-02 08:02:31 +11:00
Matthew Duggan
c81b25bf10 DGDS: Fix crash when sucking babysitter into vacuum cleaner
In Willy Beamish CD version, the dialog for this moment includes a global scene
op with no arguments.  Ignore it as the original game does.
2025-03-02 08:02:31 +11:00
Matthew Duggan
0fc24869f6 DGDS: Refactor to use references more 2025-02-01 11:24:43 +11:00
Matthew Duggan
e8e166204a DGDS: More head rendering fixes for Willy Beamish
Willy Beamish should pause script execution while waiting for a response in a
dialog, but not in dialogs with no head.

Heads should also have an "opening" state for one frame before they are
considered visible.  This avoids a frame of overlap with the previous one, just
like dialogs do.  Without this, eg, the background is not rendered behind the
teacher after returning from the principal's office during the opening
sequence.

These fixes bring Willy Beamish rendering very close to the original.
2025-01-25 16:55:57 +11:00
Matthew Duggan
68852b1a59 DGDS: Don't need return val from load dialog op 2025-01-23 21:21:32 +11:00
Matthew Duggan
b0e6fdaff7 DGDS: Fix DDS unload operation
It should unload based on file num not dialog num
2025-01-23 19:50:48 +11:00
Matthew Duggan
45a553d749 DGDS: Dump DDS data version and id on load 2025-01-23 19:50:48 +11:00
Matthew Duggan
b344d053a5 DGDS: Fixes for willy beamish interactions
Willy handles dragging of items a bit differently to the other games, try to be
a bit more like the original.  Specifically:
* Drag-drop does not need the mouse to be held down
* Don't reopen the inventory if that's where we dragged an item from

Also fix some small crashes in an older Willy Beamish demo.
2025-01-23 19:50:48 +11:00
Matthew Duggan
817ff4d8d5 DGDS: Correct a hack that breaks shooting snakes in HoC
This hack was put in before dialogs were working correctly, change it to work
more closely to how the left button down should work
2025-01-23 19:50:48 +11:00
Matthew Duggan
29900c627a DGDS: Refactor and fix conversation TTM script execution
Willy Beamish CD voice acting is now *mostly* working.
2025-01-12 16:56:07 +11:00
Matthew Duggan
91908bbdc9 DGDS: Reset look mode on scene change 2025-01-04 16:12:54 +11:00
Matthew Duggan
9eb9b6f273 DGDS: Fix mixing inventory items in Willy Beamish 2025-01-04 12:30:15 +11:00
Matthew Duggan
216d1a34c6 DGDS: Add support for targeting mode in Willy Beamish
This should make the baby sitter scene possible to complete.
2025-01-04 12:30:15 +11:00
Matthew Duggan
e4d1813663 DGDS: Fix picking up coin in Willy Beamish 2025-01-04 12:30:15 +11:00
Matthew Duggan
1248fbdea2 DGDS: Small mouse fixes for look mode 2025-01-04 12:30:15 +11:00
Matthew Duggan
631447e36b DGDS: More Willy Beamish fixes
* Swap between look and interact mode with right mouse
* Implement credits
* Mostly fix graphical glitch in intro
2024-12-31 19:02:30 +11:00
Matthew Duggan
8d7393bc6b DGDS: Implement reading of Willy Beamish reset file 2024-12-31 11:15:43 +11:00
Matthew Duggan
f79c7bec8d DGDS: Print debug after loading DDS data 2024-12-30 20:04: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
c03d39aa33 DGDS: Add debug command to show hot areas and their status
Also check inRect before checking hot area conditions during mouse move and
click.  This way around is be more efficient and functionally identical, even
though the originals do it the other way around.
2024-12-27 07:32:24 +11:00
Matthew Duggan
eefe7686fe DGDS: Fix more small Willy Beamish issues
* Looking at items in inventory now works
* Time skip buttons rendered correctly in inventory
* Scene trigger fixes (countdown and scene num now correct)
2024-12-24 14:08:42 +11:00
Matthew Duggan
49e5ccf793 DGDS: Fix opening and rendering of Willy Beamish inventory 2024-12-21 17:52:57 +11:00
Matthew Duggan
03e8c688f4 DGDS: Don't show inventory button by default in Willy Beamish
Confirmed that it does not automatically add the button to the scene like the
other games do.
2024-12-21 17:52:57 +11:00
Matthew Duggan
b4f70c660d DGDS: Refactor scene class a bit
Extract SceneOp and SceneCondition to their own files to reduce file size a
bit.

Also fix some small issues in CDS loading.
2024-12-16 18:27:13 +11:00
Matthew Duggan
1a374b66aa DGDS: Start to implement Willy Beamish CD version heads
Still quite broken but making some progress.
2024-12-16 18:23:29 +11:00
Matthew Duggan
ef64a5c814 DGDS: Implement HoC train mini game 2024-12-14 12:05:30 +11:00
Matthew Duggan
6780a9227a DGDS: Fix rendering issues in HoC inventory
* Fix header location, color, border
* Properly filter items when counting if we need to show arrows

The arrow buttons were being shown when the total held items filled the
inventory, not when the current character's items filled it.
2024-12-05 19:59:09 +11:00
Matthew Duggan
aa0b9b7d66 DGDS: Support more mouse cursors for Willy Beamish
Still a bit incomplete but should fix some of the issues.
2024-11-23 11:12:21 +11:00
Matthew Duggan
4894210917 DGDS: Avoid potential use of deallocated memory 2024-11-23 11:12:09 +11:00
Matthew Duggan
1c8bf5205f DGDS: Initial support for Willy Beamish voice acting
Still doesn't properly play the dialog action voices.
2024-11-22 21:13:06 +11:00
Matthew Duggan
e9fe7a468b DGDS: Implement some more things for Willy Beamish
Can now give the hair to the school principal near the start.
2024-11-19 21:01:41 +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
54cafe5733 DGDS: Implement Willy Beamish type talking heads
There are a few differences in the way the talking heads work in Willy Beamish
vs HoC.  This only implements the FDD version of Willy Beamish heads. The CD
version has different data to implement animated talking heads and voice
acting.
2024-11-16 21:20:35 +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
Eugene Sandulenko
18a44c676a
DGDS: I18N: Added missing POTFILES and removed redundant includes 2024-11-08 01:25:29 +01:00
Matthew Duggan
4312a96913 DGDS: Update various strings for German RotD
Some hard-coded strings needed their own version for the German version of Rise
of the Dragon.

This fixes #15456.
2024-11-05 22:19:10 +11:00
Matthew Duggan
8d088114c0 DGDS: Implement stubs for HoC minigames 2024-11-03 08:36:25 +11:00
Filippos Karapetis
6cf43726cc DGDS: Move mini-games into a separate folder
This includes the mini arcade games, as well as games with dedicated
logic, such as the shell game in HoC

Mini games for Dragon and HoC:
- Dragon: Arcade sequence: Fighting Snake (implemented)
- Dragon: Arcade: Reservoir (implemented)
- HoC: Tank 3D arcade sequence in Chengdu (missing)
- HoC: Shell game with street gambler in Istanbul (implemented)
- HoC: Train arcade sequence after Istanbul (missing)
2024-10-30 12:03:14 +02:00
Matthew Duggan
9d7266c280 DGDS: Remove redundant null checks. PVS-Studio V560 2024-10-29 17:51:58 +11:00
Matthew Duggan
2495c1bcbc DGDS: Avoid unsigned/signed comparison. PVS-Studio V1112.
Object numbers should never be negative, but globals technically can be.
2024-10-29 17:51:58 +11:00
Matthew Duggan
50cface678 DGDS: Implement Heart of China intro natives
The full intro cinematic can now play correctly.
2024-10-27 18:25:47 +11:00
Matthew Duggan
605833246a DGDS: Fix word wrapping of dialogs to be more like original
This fixes the trailing space problem that was putting some dialogs in the
wrong place and wrapping some text too much.
2024-10-26 20:07:41 +11:00
Matthew Duggan
81ca1d6296 DGDS: Fix dialog drawing on scene change 2024-10-26 16:05:00 +11:00
Matthew Duggan
21c2612456 DGDS: Fix scene ops on scene change
In d26ee6, I changed the scene ops to always be executed to the end even if the
scene changed - this was not correct and it breaks scene 60 (police cutscene)
in Rise of the Dragon, which stores the current day into a variable - but if
run twice will leave the day as 999 after leaving.

The correct behavior is not to abort ops *only* in the case of scene change to
inventory.  All other scene changes should still abort running scene ops.
2024-10-21 23:13:38 +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