Commit Graph
465 Commits
Author SHA1 Message Date
Scott Percival 2674b628c4 DIRECTOR: Free frozen lingo states in window destructor 2022-12-09 01:10:57 +01:00
Scott Percival f84d643e95 DIRECTOR: LINGO: Freeze state when score stops
If the play state for the score stops for whatever reason, Lingo will
attempt to bail early so the movie can switch over. Freeze the state so
that we can pick up execution where we left off.

Fixes the location/time announcements in DEVO Presents: Adventures of
the Smart Patrol.
2022-12-09 01:10:57 +01:00
Scott Percival 7c975eff43 DIRECTOR: LINGO: Adjust freezing/thawing behaviour 2022-12-09 01:10:57 +01:00
Scott Percival 3ea7f10467 DIRECTOR: Freeze LingoState instead of using callstack
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.
2022-12-09 01:10:57 +01:00
Scott Percival 873095c87e DIRECTOR: Move current Lingo state into Window-owned struct
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.
2022-12-09 01:10:57 +01:00
Eugene Sandulenko 97b7cb60fd DIRECTOR: Added API for referring to the cast members by name and type 2022-12-03 00:24:18 +01:00
Eugene Sandulenko a92315368a DIRECTOR: LINGO: Update screen during script execution
This ensures that cursor is updated and is smooth
2022-12-01 10:32:46 +01:00
Scott Percival 36e6246dde DIRECTOR: Add bpvar command to debugger 2022-10-22 19:53:22 +02:00
Scott Percival 2e339e3214 DIRECTOR: Include script cast member name in function list 2022-10-22 19:53:22 +02:00
Scott Percival 6aa71f2f33 DIRECTOR: Show variable contents in debug output 2022-10-22 19:53:22 +02:00
Scott Percival 802c583b10 DIRECTOR: Improve breakpoint debugger command 2022-10-06 00:05:17 +02:00
Scott Percival 82605cc3ac DIRECTOR: Implement breakpoints 2022-09-28 17:07:07 +02:00
Roland van Laar 3520f7a26f DIRECTOR: Init refCount in Datum rect constructor
Fixes memory leak on ~Datum. The Datum destructor only
destroys the objects when refcount exists.

Fixes COVERITY: 1470520
2022-09-26 11:58:40 +02:00
Scott Percival f502638290 DIRECTOR: Plug file handle memory leaks 2022-09-25 10:35:03 +02:00
Roland van Laar 6c4e6321f3 DIRECTOR: LINGO: Improve frozen context handling
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
2022-09-24 23:49:10 +02:00
Roland van Laar 15ee7ba98a DIRECTOR: LINGO: fix memory leaks for lingo tests
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
2022-09-24 23:21:38 +02:00
djsrv 4dd8a1df3e DIRECTOR: LINGO: Add missing ignoreGlobal = false 2022-09-20 17:54:41 -04:00
Scott Percival fe86d41701 DIRECTOR: Implement disasm debugger command 2022-09-20 20:17:06 +02:00
Scott Percival 29cc573d96 DIRECTOR: Update scriptframe command to include cast ID 2022-09-20 20:17:06 +02:00
Scott Percival c1ebb4d52d DIRECTOR: Implement funcs debugger command 2022-09-20 20:17:06 +02:00
Scott Percival 31472c30e2 DIRECTOR: LINGO: Split out disassembly formatting code 2022-09-20 20:17:06 +02:00
Scott Percival 8d29dec888 DIRECTOR: Implement channels debugger command 2022-09-20 20:17:06 +02:00
Roland van Laar d4ab4b3514 JANITORIAL: DIRECTOR: whitespace cleanup 2022-09-20 16:15:41 +02:00
Roland van Laar 43a2e79dec DIRECTOR: Cleanup memory leaks in LingoArchive
Create a variable on ScriptContext to track if it's only in
lctxContexts to ease deletion.

Factories and scripts with script id < 0 are tracked and deleted on
~LingoArchive. The hashmaps lctxContexts and scriptContexts overlap in
the values. The forementioned factories and scripts with script id < 0
were only in lctxContext.
scriptContexts was already cleaned up in ~LingoArchive.
2022-09-20 16:09:20 +02:00
Scott Percival b8155408f2 DIRECTOR: Add warning for unhandled Datum::reset() 2022-09-12 15:52:18 +02:00
Scott Percival c8ccf0e688 DIRECTOR: Add scriptframe command for debugger 2022-09-12 15:52:18 +02:00
Scott Percival 6876849f97 DIRECTOR: Add step, finish and next commands for debugger 2022-09-12 15:52:18 +02:00
Scott Percival 05c8119220 DIRECTOR: Start implementing Lingo debugger console 2022-09-12 15:52:18 +02:00
Scott Percival 7fc407bc4b DIRECTOR: Plug more memory leaks 2022-09-12 15:52:18 +02:00
djsrv 158e33e64b DIRECTOR: LINGO: Set ignoreGlobal to true for XObjects 2022-06-28 00:05:23 -05:00
djsrv c38ac3ed1a DIRECTOR: LINGO: Add ignoreGlobal flag to Datum 2022-06-28 00:05:23 -05:00
Eugene Sandulenko 34c617ea69 DIRECTOR: LINGO: Print MENUREF 2022-06-22 01:02:30 +02:00
Pragyansh Chaturvedi (r41k0u) f83934e05b DIRECTOR: LINGO: Implement MENUREF Datum type and STUB for Menu, Menus, MenuItem and MenuItems [WIP] 2022-06-22 00:55:14 +02:00
Eugene Sandulenko 3eb2cf61e4 DIRECTOR: LINGO: Properly implement the romanLingo 2022-05-24 00:54:04 +02:00
Pragyansh Chaturvedi (r41k0u) 4b5dc5fc99 DIRECTOR: implement STUB for kTheTrace 2022-05-24 00:41:02 +02:00
Roland van Laar db006fac21 DIRECTOR: Add debug option lingostrict
`--debugflags=lingostrict` drops into the debugger when hitting a Lingo error.

When encountering a lingo error the current lingo script execution will
stop but the engine continues as much as possible. This is great when
trying to run a game in the best possible way. It's not so great when
debugging issues, since it leaves the game in an unknown state.

The `lingostrict` option makes it clear where a lingo error occurs.
2022-04-03 11:57:35 +02:00
Roland van Laar 56d740b60f DIRECTOR: LINGO: Implement preLoadEventAbort
preLoadEventAbort is a boolean property. When true pressing keys or clicking the
mouse can or stop preloading of cast member. ScummVM doesn't preload, so
implemented as a no-op.
2022-03-19 00:18:03 +01:00
Eugene Sandulenko 08ab8cf391 DIRECTOR: LINGO: Fix object to string convesrsion 2022-03-14 12:57:19 +01:00
Eugene Sandulenko 03c83d4457 DIRCTOR: LINGO: Fix code portability 2022-03-14 12:36:38 +01:00
Eugene Sandulenko 34357fb3c0 LINGO: Mimic memory pointers in object -> string conversion 2022-03-14 12:35:07 +01:00
Roland van Laar a41f02c69d DIRECTOR: LINGO: Add comparison for Objects
When comparing an Object, i.e. FileIO instance, to an INT or STRING, the
Object is parsed as string and then compared. An Object's string is
<Object:hexcode>, e.g. <Object:794b8d0>. When compared to an INT, it's a
regular string compare.

This make saving and loading work again in Majestic.

Note: '#' < '0' due to ord '#' is 35 and ord '0' is 48.

Implemented changes:
- compare Object as STRING when it's an Object with INT or STRING
  comparison,
- set Objects string to start with <Object,
- include lingo test and
- remove BUILDBOT notification on invalid comparion.
2022-03-14 11:04:07 +01:00
Roland van Laar 45371c6799 DIRECTOR: LINGO: Add comparison INT and STRING
With INT and STRING comparisons:
- when the STRING can be parsed as an INT then it's an INT comparison,
  otherwise
- the INT is parsed as STRING and it's an STRING comparison.
2022-03-14 10:09:33 +01:00
Roland van Laar 34ba1c9fb2 DIRECTOR: LINGO: buildbot check on type comparions
`"string" > 0` is True in Lingo. Let's run the buildbot and see which
comparisons between unaligned types are used.
2022-03-13 22:54:17 +01:00
Roland van Laar 5ce2dffaee DIRECTOR: LINGO: implement updateMovieEnabled
updateMovieEnabled is a boolean. It's a flag to signal that the changes
in the movie need to be saved when branching to another movie.

The variable is implemented but without any side effect.
2022-03-11 23:23:44 +01:00
Roland van Laar eef834cbf4 DIRECTOR: LINGO: Implement the traceLoad property
The traceLoad property can be 0, 1, 2 or 3. It specifies how much
verbosity is shown when loading cast members.

It's a bt useless for ScummVM. We have our own verbosity mechanism.
Furthermore ScummVM loads all casts up front and unload is a no op.
2022-03-11 23:23:44 +01:00
Roland van Laar 8d22aa3af1 DIRECTOR: LINGO: Implement the actorList property
The actorList is a global array property. Birthed scripts can be added
to it. The `stepFrame` method is called on all objects in the array on
every frame. < D4 had an executePerFrameHook for this.
2022-03-11 21:58:15 +01:00
Roland van Laar 2a1149a453 DIRECTOR: LINGO: Implement property the exitLock
In Director the exitLock prevents quitting the program when it's set to
TRUE. get and set for the exitLock is implemented.

The underlying functionality, preventing exiting a program, is not
implemented. ScummVM should always respond to a QUIT event.
2022-03-11 20:32:54 +01:00
Roland van Laar 95fc5560f9 Director: Implement the searchPath
the searchPath is an array that contains paths that need to be searched
when opening a file. It's a property on the same global level in the
same way itemDelimeter is.

The searchPath is set via cb_theassign2. It's used for assigning
properties to the movie itself. `g_lingo` in the case of ScummVM.

The only known case for cb_theassign2 is in the game Louis Catorze
where it's only used for the searchPath.

Note: cb_theassign() does the same thing for script and factories
2022-03-10 23:42:37 +01:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
Orgad Shaneh 02cfffcb67 DIRECTOR: Use nullptr
Using clang-tidy modernize-use-nullptr
2021-11-14 15:51:59 +02:00