Commit Graph
164 Commits
Author SHA1 Message Date
Scott Percival 2ff3357dac DIRECTOR: Refactor Channel to remove overlay position/dimensions
The original logic doesn't hold up to testing. The position/width/height
of a sprite can be changed at any time without any extra flags; although
the screen needs to be redrawn before you can see any change.

The main thing that the sprite puppet flag does is determine if sprites
are updated from the score data when the frame changes.

Fixes the broken mouse cursor tracking sprite in Chop Suey.

Fixes the sprite scaling in the Doc Martens minigame in Virtual
Nightclub.

Fixes director-tests/D4-unit/T_SPRT01.DIR
2024-05-18 13:56:01 +02:00
Scott Percival d1a739fbce DIRECTOR: Fix scaling of sprites in score frames
Sprites in a score frame have a width and a height; it appears these
values are only to be used if the "stretch" flag is set. Otherwise, the
cast dimensions are used.

Fixes the scaling when picking up the photo album from the filing
cabinet in P.A.W.S.
2024-05-12 22:00:19 +02:00
Scott Percival 45c9abff93 DIRECTOR: Refactor Channel::getMask()
The Mask ink type allows Director to combine a sprite with a 1bpp
mask bitmap to stencil an image. Previously we were using the widget
drawing code to generate this image, which caused issues with scaling
and depth (as the surface was formatted to match the screen). The new
code checks for a 1bpp image specifically and sends it through, removing
the workarounds for screen depth.

Fixes the drawing of the welcome cube at the start of Virtual Nightclub.
2024-05-12 22:00:19 +02:00
Scott Percival 517a1563df DIRECTOR: Make sprite dragging relative to the mouse click
Fixes putting the quarter into the binoculars in Hell Cab.
Fixes most of the demos in Face Kit.
2024-04-25 00:54:17 +02:00
Scott Percival 8ebfb3a2ea DIRECTOR: Fix digital video playback state leak
Playing two digital videos back to back in the same channel was not
working; both videos thought they controlled the channel, which meant
that the first video would complete, then set _movieRate in the channel
to 0, which would then be misinterpreted by e.g.
Score::isWaitingForNextFrame() as a sign that the second video had
finished.

Fixes the introductory videos in Eastern Mind.

Fixes the conversation with the two ladies at the river in Wrath of the
Gods.
2024-04-25 00:54:17 +02:00
Scott Percival eb5b867b36 DIRECTOR: Refactor Channel::getBbox
The behaviour in real Director is to allow width/height/position
changes in Lingo, but only apply them when the Sprite puppet flag is
set.
2024-04-25 00:54:17 +02:00
Scott Percival d285d1a9d5 DIRECTOR: Add guardrail for empty film loops 2024-03-31 16:58:31 +02:00
Scott Percival 27cd3a75aa DIRECTOR: Proactively attempt to load DigitalVideoCastMember
Having the loading action only happen in Channel::setClean doesn't cover frame 1,
which is a straight copy from the frame data.

Fixes the logo movie loading in Escape From Planet Arizona.
2024-03-11 01:04:43 +01:00
Scott Percival ea07939c1b DIRECTOR: Fix Channel::setClean resetting the same video
Fixes introductory movies in The Dark Eye.
2024-02-09 21:17:57 +08:00
Scott Percival c4fe1add55 DIRECTOR: Persist editable status on sprites if cast is the same
Fixes text box deselecting when talking to the cops in Spaceship
Warlock.
2024-01-30 23:30:11 +01:00
Scott Percival 5d69024aa4 DIRECTOR: Clean up Score methods that previously needed frameId 2024-01-30 23:30:11 +01:00
Scott Percival 2d1094a091 DIRECTOR: LINGO: Allow reversed bound args to b_spriteBox
Fixes the targeting lines in the storm chasing minigame of Team Xtreme:
Operation Weather Disaster.
2024-01-30 23:30:11 +01:00
Scott Percival a8fe30029d DIRECTOR: Force editable text boxes to be rendered in front
Editable text boxes don't seem to abide by the channel rendering order;
you can have a bitmap in a higher channel that entirely obscures a text
entry widget, and the widget will still be visible.

Fixes the visibility of the name entry text box in Cosmology of Kyoto.
2024-01-20 23:14:52 +01:00
Scott Percival 1ac78ddf44 DIRECTOR: Add fast path for kInkTypeCopy 2023-11-25 02:03:38 +01:00
kartiksharmakk 545073caa9 DIRECTOR : Fix kInkTypeCopy Blending Issues.
1-bit sprites will not blend with kInkTypeCopy , whereas 8-bit will.

Trello card : https://trello.com/c/mpZTlPoZ/628-physical-energy-game-bar-not-filled
2023-11-21 20:19:35 +01:00
kartiksharmakk 164620e6e6 DIRECTOR : Fix physical energy game bar not filled in total distortion.
It is partial revert of 3cb61c54d7

Steps to reproduce:
1. Start Total Distortion
2. Start a new game / load game
3. Click on the "Options" button
4. The physical energy bar is not visible

Trello card : https://trello.com/c/mpZTlPoZ/628-physical-energy-game-bar-not-filled
2023-11-21 20:19:35 +01:00
Harishankar Kumar 7421ccdc39 DIRECTOR: Fix formatting and change method names 2023-08-03 09:49:20 +02:00
Harishankar Kumar 442c1a5d41 DIRECTOR: Implement events for scroll type text cast
This patch implements events for scrolltype text cast members, callbacks
in MacTextWindow is used to redirect events to director engine.

`ATD\HD\bbTWRFL2.DXR@392` of 'totaldistortion-win' uses `mouseUp` score
script attached to scrolltype text cast member, which when clicked calls
`getMouseLine` to find the clicked book, thus opening it.
2023-08-03 09:49:20 +02:00
Harishankar Kumar 6dbbed5d2b DIRECTOR: Release channel widget from window manager if window type 2023-08-03 09:49:20 +02:00
Eugene Sandulenko 8bccc12786 DIRECTOR: Reduce header dependency 2023-08-02 21:05:06 +02:00
Harishankar Kumar 7b6b6a5541 DIRECTOR: Refactor checks inside setAutoPuppet function
To make code cleaner and avoid duplication of code, moved the checks
inside setAutoPuppet function.
2023-07-19 14:57:59 +02:00
Harishankar Kumar e01bb235f7 DIRECTOR: Support individual auto-puppet sprites properties
According to "Director in a Nutshell, page 15", autoPuppet unlike
puppet is not a single property, instead it is individual for each
sprite property, ie we can have auto-puppet locH of sprite, but
other properties are not auto-puppet.

This change adds support for individual auto-puppet properties.
2023-07-19 14:57:59 +02:00
Harishankar Kumar 994d284d71 DIRECTOR: Set sprite _startPoint when setting location
Initially, all the changes to sprite location (ie set the locH..) was
being assigned to _currentPoint, which is not carried over to sprite,
thus the changes were not being applied.

Fixes bullet not showing when firing gun in
--start-movie="ATD\HD\bdDREAMA.DXR" totaldistortion-win
2023-07-19 14:57:59 +02:00
Harishankar Kumar 59f0433c5a DIRECTOR: Add >=D6 checks to autoPuppet cast property. 2023-07-19 14:57:59 +02:00
Eugene Sandulenko 87b96cd34e DIRECTOR: Re-add Director version checks for autopuppet flag
Dropping D6+ checks there were a speculation which let Dream sequence
in totaldistortion work. However, that had a side effect that the ink
was not copied, as the channel was declared autopuppet.

This restores the ink behaviour while keeping shooting as working

--start-movie="ATD\HD\bdDREAMA.DXR"  totaldistortion-win
2023-07-14 22:34:38 +02:00
Eugene Sandulenko 9160173b0a DIRECTOR: Do not override autopuppet sprites 2023-07-10 16:03:11 +02:00
Eugene Sandulenko f594c08eca DIRECTOR: Treat autopuppets same as puppets when looking at sprite changes 2023-07-10 16:03:11 +02:00
Eugene Sandulenko e99a9d4511 DIRECTOR: Check sprites for bg/fg changes when rendering 2023-07-10 16:03:11 +02:00
Eugene Sandulenko 4a259ea14f DIRECTOR: Set autopuppet flag for all D versions 2023-07-10 16:03:11 +02:00
Scott Percival 17e1853347 DIRECTOR: Refactor path detection
Previously, paths were verified by pathMakeRelative().
This method had several drawbacks; the code was increasingly ad-hoc
and recursive, and the function would return a Common::String that
was not guaranteed to be distinct. 90% of the time the path would need
to be converted to Common::Path so that file streams could use it.

This code has been replaced with findPath(), a function which takes a
path string as recieved from Director (e.g. a Lingo script, a filename
stored in a CastInfo record) and returns a Common::Path object for the
file on the local system. The inner workings have been split into subfunctions,
which should make it easier to add workarounds and fuzz at the correct
layer.
2023-07-08 22:01:00 +03:00
Eugene Sandulenko 6acba833de DIRECTOR: Properly fix set rect of sprite
We used to check against puppet: wrong, it even gets autopuppeted
We used to check against stretch: wrong, we just do not stretch the sprite

This properly fixes cursors in devo and darkeye without disabling setting
the rect property.

See commit 18f140ef91
2023-07-01 16:39:35 +02:00
Eugene Sandulenko 18f140ef91 DIRECTOR: Do not set autopuppet flag on rect of sprite
This ifxes cursor regression in devo (initial movie) and
dark eye (--start-movie=DKYDATA/DIRFILES/NT.DIR)
2023-06-30 23:51:35 +02:00
Harishankar Kumar 5a5e205e0d DIRECTOR: Add _autoPuppet flag, initial work for D6 auto-puppeting
[Based on Director in a Nutshell, page 15]
The following properties of a sprite are auto-puppeted whenever
the property is set: backColor, blend, editable, foreColor, height,
ink, loc, locH, locV, member, moveable, rect and width. Auto-puppeting
of individual properties has no effect on the puppet of sprite property

['Lingo Dictionary' 601 Fixes]
Sprites now have a duration as specified in the (new) score view.
When lingo modifies any of the sprite properties that property
will be auto-puppeted, i.e. the value set will stick for the
duration of that sprite despite any values recorded in the score.
This can cause existing lingo which relied on setting the property
of a sprite without the use of 'puppet' to behave differently.
Calling 'puppetSprite spriteNumber, FALSE' will also clear any
currently auto-puppeted properties.
2023-06-10 16:18:34 +02:00
Harishankar Kumar bcd4a82075 DIRECTOR: remove puppet checks when setting sprite properties
In original engine it is possible to set non-puppted sprite properties
like position, backcolor etc and then call updatestage to update the
screen according to property. This is undocumented behaviour
which is not present depicted in any books however with rigorous testing
it is found to be true. This change only persist for the current frame
and once the playback head is moving the change is lost.

`ATD\HD\bdDREAMA.DXR` of 'totaldistortion' used some of this quirk to
display moving bullets.
2023-06-10 16:18:34 +02:00
Eugene Sandulenko ef6a7b7daf DIRECTOR: Setting sprite box is allowed for stretched sprites, and add sanity checks
This fixed picking animals in zoo in the7colors. --start-movie=06DEPTSTORE:7F:DeptP3-06
2023-06-03 00:03:36 +02:00
Scott Percival cf886b17e7 DIRECTOR: Fix regression in sprite dragging
Sprites with the movable attribute set do not need to be a puppet.
2023-05-28 14:44:09 +02:00
Scott Percival bcb502d634 DIRECTOR: Move getRegistrationOffset and getBbox to CastMember 2023-05-28 14:44:09 +02:00
Eugene Sandulenko 2321decd30 DIRECTOR: Persist immeidate sprite flag when copying channels
Lingo `set the immediate of sprite` is getting lost when we copy over
the sprites to the channels. Now we inherit this setting in the copy.

Fixes 'PopUp Menu' in theapartment: without this fix we are losing the
interactivity as soon as we select a pop-up menu item once.
2023-05-17 23:14:07 +02:00
Scott Percival f703ee6ecf DIRECTOR: Split CastMember classes into files 2023-04-29 14:20:05 +02:00
Scott Percival 3cb61c54d7 DIRECTOR: Fix kInkTypeBlend, remove redundant _blend field on Sprite 2023-03-16 14:46:18 +01:00
Scott Percival 9ee0740844 DIRECTOR: Reset Channel::_movieTime when loading a new video
Fixes the animation of turning the ship in Gadget: Invention,
Travel and Adventure.
2023-01-27 13:31:21 +01:00
Scott Percival bbc464a7bc DIRECTOR: Fix matte display for 1-bit images 2023-01-10 13:41:53 +01:00
Scott Percival 48740a2ad1 DIRECTOR: Remove all palette reversing workarounds
All of the builtin palette lookup tables have been reversed, to match
the original layout of the tables in the Director 4 projector executable.
This corresponds with the colour indexing used in Lingo.
Likewise, the code to load palettes from the cast no longer reads the
colours in reverse order, and shiftPalette no longer expects
the start index to be after the end index.

DirectorEngine::transformColor still exists to upgrade to 32-bit colour,
but no longer reverses the palette index.

The missing builtin 16-color palettes from Director 4 have been added.
2023-01-10 13:41:53 +01:00
Scott Percival 665a76536e DIRECTOR: Fix setter for "the rect of sprite"
Normally you can only change the width and height of a sprite when the
sprite is a puppet, and the stretch flag is set. Apparently for shapes,
all that's required is the puppet flag.

Fixes the mouse cursor bounding box in DEVO Presents: Adventures of the
Smart Patrol.
2022-11-18 16:28:05 +01:00
Scott Percival 1524ee3615 DIRECTOR: Fix coloring of 1-bit bitmaps
If a channel contains a 1-bit bitmap cast member, use the foreground
color instead of black when rendering in Background Transparent mode.

Fixes various text bitmaps in Total Distortion and iD4 Mission Disk 1.
2022-11-18 16:28:05 +01:00
Scott Percival b2d13c5ea1 DIRECTOR: Stop playing videos when sprite gets replaced
Fixes cupcake song not stopping in Chop Suey.
2022-10-06 00:05:17 +02:00
Scott Percival e477106daa DIRECTOR: Update Channel::_movieTime in Score::updateWidgets
Previously this would be updated in
DigitalVideoCastMember::createWidget, which meant it was possible for a
movie to complete without updating _movieTime to the final end position.

Fixes the cupcakes from not stopping animating once the song is finished
in Chop Suey.
2022-10-06 00:05:17 +02:00
Scott Percival b572de94a4 DIRECTOR: Hardcode white and black in Channel::getPlotData()
Blit operations in Director expect that the "white" and "black" color
indexes are at 255 and 0, respectively. Fetching these values from
the window manager is not reliable when the palette has multiple
indexes sharing a color (e.g. blackPalette and whitePalette), which will
mean the applyColor flag is incorrectly set to true when foreColor and
backColor are the correct values.

Fixes fade from white when entering the door to the Land of Desire in
Eastern Mind.
2022-09-12 15:52:18 +02:00
Pragyansh Chaturvedi fb6497a059 DIRECTOR: Fix constrainH fail build step in BUILDBOT by adding _constraint check 2022-07-02 23:58:15 +02:00
Pragyansh Chaturvedi 42dfdd9f35 DIRECTOR: LINGO: Implement constraint in Channel::getBbox(), Fix getActive() to return true for movable sprites 2022-06-26 22:53:08 -05:00