This patch fixes the behaviour of windows when setting their
properties (e.g. titleVisibility, Modal, etc) from the lingo.
Initially the window was set to be visible when the property was
set, but this is not the expected behaviour. The window should
only be visible when the `open` command is called. Removed `setVisible(true)`
from various window properties assignment functions.
Fixes popupmenu overlay in `meet-mediaband` and white rectangle when
opening `mcluhan-win`.
--start-movie="main\stvimenu.dxr" mediaband-win
In the original engine, the enterFrame handler can only be called
recursively upto second depth, and the third call will be ignored.
This was formerly implemented by counting number of frozen lingo
states, however there are cases where the lingo state is frozen,
while enterFrame handler not called, so the count is not accurate.
This patch improves the logic by counting the number of enterFrame
in frozen lingo states as well, so it can be identified that these
previous frames are indeed of `enterFrame` handler.
Fixes bug where the elevator when jumping to next floor (yellow one)
broke dimensional movement in `totaldistortion-win`.
When changing from shared casts in `Window::loadNewSharedCast`, and in
instance where previousCast need to be deleted, we just deleted the cast
itself but not the underlying `Archive`, this resulted in memory leaks.
`~Director()` was not deleting this archive because it was being removed
from `_allSeenResFiles` in favour of loading new archive.
Fixed by deleting `Archive *_castArchive` of previousCast after erasing
its entry from `_allSeenResFiles`.
When reloading the shared cast, erase the references from both
_allSeenResFiles and _allOpenResFiles. In the case that the shared
cast is reloaded from a different path, this would leave a dangling
reference in _allOpenResFiles. This would then lead to a crash later
when enumerating _allOpenResFiles and trying to access the found
path in _allSeenResFiles.
Fixes a crash in the D4 version of Alice which would occur when loading
the cursor. This occurs since Alice ends up loading first Shared.dir and
then DATA:Shared.dir, leaving a dangling reference to Shared.dir in
_allSeenResFiles.
Issue was introduced in 9aa0958736.
Normally Director will look for a movie of the same name as the window,
however with `the fileName` property, it can assign name of movie to be
played in the window.
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.
Make DirectorEngine::_allOpenResFiles the de-facto owner of Archive *
objects, move all of the various loadEXE/loadMac methods off Window and
onto DirectorEngine, and replace inline Archive loading with
openArchive().
Implements modal property using the locking widgets of macwindowmanager.
`modal of window` in 'workshop' uses this.
Co-authored-by: Pragyansh Chaturvedi <pragyanshchaturvedi18@gmail.com>
Modifies border of window by first changing title to "", then updating
window border to borderType 2 `ThinNoTitle`.
`titleVisible of window` to verify this behavior.
Co-authored-by: Pragyansh Chaturvedi <pragyanshchaturvedi18@gmail.com>
Adds the support to get/set field 'rect' of window object, interally it modifies the inner dimension of window object.
'mcluhan' used this to set window dimensions of background windows (through tell), Additionally `rect of window` in `workshop` also uses this patch for setting/getting field `rect` of window.
resize function is extracted to new function resize and resizeInner,
also a new private function rebuildSurface is created to handle common
code of refreshing/rebuilding surface after modifying inner or outer
window dimensions.
No longer needed, the scaling should happen when updating the widget.
Fixes adjusting sprites with Lingo, such as in DEVO Presents:
Adventures of the Smart Patrol.
These days we are checking path validity in Window::setNextMovie(),
thus, forcing _currentPath leaded to inability to load movies from
root when called from within a subdirectory.
Fixes alice-win
Previously, the Lingo state would be frozen by persisting the frames on
the bottom of the callstack with a special flag. This required extra
logic to determine whether or not the callstack was intended to be empty
after execution finished, with some complex edge cases.
The new approach is to swap out the LingoState object on the window,
meaning that an empty callstack always signifies execution has completed.
It remains to be seen if we'll need to track more than one frozen
context; for now it seems to be okay.
Fixes driving to locations in DEVO Presents: Adventures of the Smart Patrol.
The previous arrangement was to copy the bits of Lingo state back and forth from
the Window object to the Lingo instance, and query the window for the
callstack. This refactor consolidates the current Lingo state into a single
struct, owned by the Window object and accessible via a pointer on the
Lingo object.
The loading of the next movie and corresponding shared cast
is now handled in seperate functions.
There checks when to load a new shared cast and when to delete
the previous one could be simplified by returning early when the
previous and new shared casts are the same.
At the same time it fixes a Dereference after null check from Coverity.
sharedCast->getArchive() could return a null pointer and wasn't checked
in all places.
Fixes COVERITY: 1498090
When an error happens during go, for example with a nonexisting movie
the lingo callstack isn't cleaned up properly.
Now the callstack is cleaned up via `popContext(aborting=true)`.
This improves on commit:
DIRECTOR: fix memleak when lingo context is frozen
27b314cb25
The Lingo tests were failing because of memory leaks.
- `move` overwrote an existing cast without deleting it
- `puppetTransition` was set but not removed on class destruction
- the *.lingo test files were opened but never removed
Cleanup the lingo callstack when closing.
When a movie calls `go frameId` a big pause button is hit
and everything is put into order to not go to the frame +1
but to the requested frameId. That big pause button is called
`_freezeContext`.
However when quitting in the middle of a frozen context
there are lingo frames left on the callstack.
This can be reliably reproduced with a plethora of D2 and D3 movies
with the debugflags fewframesonly,fast.
Lingo function `closeResFile` is only responsible for closing resource
file opened by `openResFile`. Register in `openResFile` which files
where opened and close only those files in `closeResFile`.
- Rename `_openResFiles` to `_allOpenResFiles` and
- Add new `_openResFiles` hashmap to track which files were opened in
`openResFile`.
A pointer to sharedCast was stored in the HashMap_openResFiles.
sharedCasts were deleted when a switch to a new movie was made
while _openResFiles is cleared when quitting Director.
This fix removes the reference to the shared cast when the shared cast
is deleted.
The engine treats film loops as N full channels getting rendered to the
screen in the space of one. As such, it's impossible to pre-blit together
the content, as any blitter mode can be used for each of the items.