Commit Graph
440 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 93373b0795 DIRECTOR: Allow Lingo::pushContext to set me handle to null
It's possible to call a method designed for a me object with any
nonsense in the first argument. By design, this should look up the
clean function handler in the script context instead of the one in the
offspring object. However the "me" handle needs to be nulled out,
or else accessing properties will leak through from the previous
object.

Fixes saving games in DEVO Presents: Adventures of the Smart Patrol.
2022-12-09 01:10:57 +01:00
Scott Percival 65b341b5c1 DIRECTOR: LINGO: Fix LC::negateData to work on a copy
Fixes scene switching in DEVO Presents: Adventures of the Smart Patrol.
2022-12-09 01:10:57 +01:00
Scott Percival 7a8d4bfeb9 DIRECTOR: LINGO: Add func_goto* logs to kDebugLingoExec 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 30e9d330df DIRECTOR: Implement the paramCount
At first glance it would seem we could use funcSym.nargs for this,
except it is fixed to the number of args in the function definition.
We also can't derive it from the argument list that is sent through,
as it is truncated/padded with VOIDs. To keep things simple, track
paramCount as part of CFrame.
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 7e52767267 DIRECTOR: LINGO: Allow built-ins to be overridden
A good example of it is Panic Parc demo, where the setProp built-in
gets redefined
2022-12-01 10:32:43 +01:00
Scott Percival f36205be67 DIRECTOR: Reduce Lingo warning spam 2022-11-18 16:28:05 +01:00
Scott Percival 82605cc3ac DIRECTOR: Implement breakpoints 2022-09-28 17:07:07 +02:00
Scott Percival 15a9cbe002 DIRECTOR: LINGO: Fix Datum leak in c_starts 2022-09-25 10:35:03 +02:00
Roland van Laar d4bc98d121 DIRECTOR: LINGO: switch to use datum constructor
The datum constructor is overloaded and handles setting the type.
Instead of setting the type by hand we leverage the constructor.

The in this commit are mainly for Datums of type int.
2022-09-21 12:14:35 +02:00
Roland van Laar 7b77a87390 DIRECTOR: LINGO: Create new datum on checks
Various equality checks used the first datum to signal the value of the
check. Setting the Datums type to int in the process.
Datum's destructor only removes the item that corresponds with it's
current type.

For example, when comparing two strings, d1 and d2. D1's type would
be set to int indicating if there was a match. D1, now being an int,
would not remove the string on destruction. The result is a memory leak.
2022-09-21 12:06:30 +02:00
Roland van Laar 2d2d61f8ff DIRECTOR: LINGO: Fix deleting first item
Given an item list: "lorem,ipsum,dolor,sit,amet" and the lingo code:
`delete item 1 of list`.
The first item "lorem" was deleted but without the comma. Leaving an
empty first item.

In Star Trek: The Next Generation Interactive Technical Manual the
code repeatedly deleted the first item till it encountered an `@`.
The result was a loop in which it was stuck.

- Includes lingo test.
2022-09-15 14:46:46 +02:00
Scott Percival 6876849f97 DIRECTOR: Add step, finish and next commands for debugger 2022-09-12 15:52:18 +02:00
Pragyansh Chaturvedi (r41k0u) 3eea6c2a9f DIRECTOR: LINGO: Check for wrong menu and menuItem types when invoking Lingo::getTheEntity() or Lingo::setTheEntity() for MENUREF Datums 2022-06-22 00:55:14 +02:00
Pragyansh Chaturvedi (r41k0u) 9fa3ec41f0 DIRECTOR: LINGO: Implement MENUREF in LC::c_theentityassign() and check for nullptr 2022-06-22 00:55:14 +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
Pragyansh Chaturvedi (r41k0u) b8fec96b8f DIRECTOR: remove kTheMenuItem STUB in setTheEntity() and get rid of c_themenuitementityassign to remove duplicacy 2022-06-22 00:55:14 +02:00
Pragyansh Chaturvedi (r41k0u) 60fdff4231 DIRECTOR: LINGO: Replace printSTUBWithArglist with macro printWithArglist 2022-06-16 22:46:30 -05:00
Eugene Sandulenko 4fb6e147a8 DIRECTOR: LINGO: Fixed arithmetic operations with POINT and RECT
And added relevant tests
2022-06-04 20:02:49 +02: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
Scott Percival 9c6d95e041 DIRECTOR: LINGO: Make m_perform inject the current object into the stack
Fixes the dialogue trees in Total Distortion.
2021-09-19 14:17:36 +08:00
Filippos Karapetis d260b1e9e6 DIRECTOR: LINGO: Add overloaded operators for Datum structs 2021-08-30 19:08:15 -04:00
djsrv 0fa9a79c70 DIRECTOR: LINGO: Fix invalid comparison results 2021-08-29 23:23:26 -04:00
djsrv b52b47f227 DIRECTOR: LINGO: Init globals to 0 in D2-3 2021-08-11 18:42:37 -04:00
djsrv 9b6635b66a DIRECTOR: LINGO: Don't warn about missing mNew return val 2021-08-11 13:37:41 -04:00
djsrv 701b8dc997 DIRECTOR: LINGO: Eliminate returnNumber
It turns out b_value can return values other than numbers despite the
documentation. returnNumber is no longer needed.
2021-08-10 16:49:43 -04:00
djsrv 40da239e76 DIRECTOR: LINGO: Expect extra values on stack when aborting 2021-08-04 20:00:43 -04:00
Eugene Sandulenko 24e45c560e DIRECTOR: LINGO: Do not trigger buildbot error on scummvm asserts 2021-08-05 01:15:27 +02:00
djsrv b8a7902907 DIRECTOR: LINGO: Include undefined handler's name in warning 2021-08-02 19:37:19 -04:00
ysj1173886760 119253ce3f DIRECTOR: add sorted attribute for array type datum. 2021-07-28 14:53:13 +08:00
djsrv fc1831a462 DIRECTOR: LINGO: Replace _hasFrozenContext
This fixes https://trello.com/c/bucHPI2F/429-majestic-regression
hasFrozenContext is now a function which checks the call stack for
frozen contexts. Not updating this variable manually leaves less room
for error.
2021-07-26 12:59:06 -04:00
djsrv 7f0ae2b827 DIRECTOR: LINGO: Improve switching between windows
This saves/loads more Lingo state to the window so that running Lingo in
multiple windows is safer.
2021-07-26 12:59:06 -04:00
djsrv 5890475fae DIRECTOR: LINGO: Make CFrame field names more consistent 2021-07-26 12:59:06 -04:00
djsrv 5a7c191ac4 DIRECTOR: LINGO: Create one call stack per window
Since there may be frames left on the call stack after Lingo::execute()
is called now, it isn't safe to share one call stack between several
movies executing in parallel.
2021-07-21 20:35:40 -04:00
djsrv e2a34fccc1 DIRECTOR: LINGO: Temporarily freeze script context in func_goto 2021-07-21 18:27:05 -04:00
djsrv 2e8d061cc8 DIRECTOR: LINGO: Remove g_lingo->_currentArchive
All uses of this have been removed since we can't rely on the archive to
still exist when switching movies.
2021-07-21 18:27:05 -04:00
djsrv 8d56798784 DIRECTOR: LINGO: Properly ref count script contexts 2021-07-21 18:27:05 -04:00
djsrv 3c0b31ef97 DIRECTOR: LINGO: Code name arguments as string
We can't just code the names as integer IDs and look them up later.
The name table will be deleted when the movies switches.
2021-07-21 18:27:05 -04:00
djsrv ca0b1f5de1 DIRECTOR: LINGO: Normalize strings in equality tests 2021-07-15 16:31:47 -04:00
djsrv d0df2bd014 DIRECTOR: LINGO: Use '\r' as line delimiter 2021-07-15 16:31:47 -04:00
djsrv 860a8d663a DIRECTOR: LINGO: Make chunk refs handle Unicode 2021-07-15 16:31:47 -04:00
djsrv 1f26871c97 DIRECTOR: LINGO: Check if end is non-negative before using 2021-07-06 23:35:25 -04:00
djsrv 04ae8edaab DIRECTOR: LINGO: Change dropping return value warning to debug
Sometimes needing to drop the return value is expected for handlers, so
this shouldn't be a warning.
2021-07-01 12:23:42 -04:00
djsrv 615995fdc1 DIRECTOR: Change member refs to use CastMemberID 2021-06-30 22:32:19 -04:00
ysj1173886760 4a38579f44 DIRECTOR: don't regard quick draw shape as matte type 2021-06-30 16:29:00 +02:00
djsrv 21988c77bf DIRECTOR: LINGO: Fix warnings 2021-06-28 19:59:53 -04:00