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.
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
* 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
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.
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.
* 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
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.
* Looking at items in inventory now works
* Time skip buttons rendered correctly in inventory
* Scene trigger fixes (countdown and scene num now correct)
* 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.
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.
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.
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)
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.
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.