aboutsummaryrefslogtreecommitdiff
path: root/engines/scumm/script.cpp
AgeCommit message (Collapse)Author
2017-12-01SCUMM: Fix array overflow writing var when no current script is setColin Snover
This situation is triggered normally when _currentScript is 0xFF, but it could potentially also happen if _currentScript is some other number >= NUM_SCRIPT_SLOT, so the check is a bit more conservative than it might appear to need to be.
2014-12-02SCUMM: Maniac V0: Correctly handle 'slanted' walk-boxes, Add new variables ↵Robert Crossfield
to save-games, Bump the SaveGame Version number, remove obsolete V0 code in V2 functions
2014-11-28SCUMM: Maniac V0: Implement the original Walk Code (to fix some anim ↵Robert Crossfield
glitches), fix opcode to use _moving correctly (as V0 is different)
2014-08-20SCUMM: Add support for quit script in HE90+ games.Kirben
2014-02-18SCUMM: Make GPL headers consistent in themselves.Johannes Schickel
2013-05-01SCUMM: Change NUM_SCRIPT_LOCALS to NUM_SCRIPT_LOCALTorbjörn Andersson
For consistency with NUM_SCRIPT_SLOT.
2013-05-01SCUMM: Fix out-of-bounds access in runScript() debug messagesTorbjörn Andersson
I believe this fixes CID 1003954, 1003957, 1003958, 1003962 and 1003966.
2013-04-30SCUMM: CleanupTorbjörn Andersson
We only need to initialize 'args' in runInventoryScript() when we are actually using them.
2013-04-30SCUMM: Use correct array size when calling initializeLocals()Torbjörn Andersson
The initializeLocals() function assumes that it can copy 25 elements when being provided an array of values. But this array was frequently a lot smaller than that. I've introduced a constant for the number of locals (though VirtualMachineState has one more for some reason), and fixed the array sizes in a number of places. CID 1003951, 1003952, 1003953, 1003955, 1003956, 1003959, 1003960, 1003961, 1003963, 100394, 1003965
2012-12-15SCUMM: Handle double-clicks in Mac Loom (bug #3588164)Torbjörn Andersson
Unlike the EGA DOS version, it doesn't seem to be the scripts that keep track of double-clicks. Instead, the engine sets a variable to indicate them. Unlike the DOS version, we don't check that the second click happens close enough on the screen to the first one. We could, but it seemed needlessly complicated.
2012-05-31SCUMM: Change the nest.number default to zero in stopScript and ↵Travis Howell
stopObjectScript too.
2012-05-31SCUMM: Fix global script 255 never been resumed by runScriptNested. Thanks ↵Travis Howell
to clone2727 for tracking down the problem in baseball2003.
2012-02-11SCUMM: replace "c64" with "v0" when it applies to both C64 and AppleII v0 ↵Tobias Gunkel
versions In addition some routines (e.g. the gfx ones) that are even used in v1.
2012-02-11SCUMM: adjust to coding style-guideTobias Gunkel
2012-02-11SCUMM: fix gcc compiler warningsTobias Gunkel
2012-02-11SCUMM: handle v0 distance check in checkPendingWalkAction() correctlyTobias Gunkel
2012-02-11SCUMM: Fix for V0 objectsRobert Crossfield
2012-02-11SCUMM: keep track of the number of nested script calls for a sentenceTobias Gunkel
command in v0 If for instance an object necessary for the sentence command is not reachable or pickupable (try to use faucet (object 55) with jar with water in microwave (object 50), the pick-up script of the jar will tell the actor to pickup object 99 (jar not in microwave)) the actor will try to pick-up the jar infinitely. This is fixed by counting the amount of nested scripts the sentence command has called (directly or indirectly) so far and aborts it if there have been too many.
2012-02-11SCUMM: complete handling of pending walkTo actions for sentence commandsTobias Gunkel
in v0
2012-02-11SCUMM: handle actor freeze in walkToActorOrObject()Tobias Gunkel
2012-02-11SCUMM: fix blank sentence line in v0 after cutscenes and remove unused ↵Tobias Gunkel
parameter of resetSentence()
2012-02-11SCUMM: merge object v0 id and type into one object varTobias Gunkel
2012-02-11SCUMM: merge _activeObjectNr/_activeObjectType and _cmdObjectNr/_cmdObjectTypeTobias Gunkel
2012-02-11SCUMM: fix debugger for v0Tobias Gunkel
2012-02-11SCUMM: pop stack in v0 if command's object1 and 2 are the sameTobias Gunkel
Otherwise the command will never be removed and the stack overflows
2012-02-11SCUMM: reset sentence line in v0 if sentence executedTobias Gunkel
2012-02-11SCUMM: fix verb and script handlingTobias Gunkel
- getVerbEntrypoint() should not handle walk-to differently (revert 0x0D handling back to original behavior) - VAR_ACTIVE_ACTOR actually is VAR_ACTIVE_OBJECT2 - runSentenceScript(): "if (_cmdVerb == kVerbWalkTo)" must be "if (_cmdVerb != kVerbWalkTo)"
2012-02-11SCUMM: use command stack and SentenceTab in mm c64Tobias Gunkel
- MM C64 uses command stack (SentenceTab, doSentence()) now - _cmdObject... added for current SentenceTab. The _active... variables are only used to build a sentence in the inventory but never by a script. -> many routines are not needed anymore and are removed
2012-02-11SCUMM: start handling object type and id correctly in mm c64Tobias Gunkel
- removed complicated and unnecessary _v0ObjectIndex, _v0ObjectInInventory, _v0ObjectFlag vars - started to merge object id and type into one object value (type<<8|id) - verb preposition ids do not dependent on language -> remove from VerbSettings Note: - objects with type=0 are foreground objects. They have a state, an owner and a bg overlay image. - objects with type=1 are bg objects. They do not have a state or owner and are already contained in the bg image. The do not have an entry in objectState/OwnerTable
2012-01-14SCUMM: Fix workaround for Dig spider lair sound glitchTorbjörn Andersson
The soundKludge() function assumes there are always 8 parameters for Digital iMUSE script commands.
2012-01-08SCUMM: Work around script bug in The DigTorbjörn Andersson
The sound of trickling water in the spider lair is started, but never explicitly stopped, so it keeps going. (Possibly not forever. When I tried it in DOSBox, it finally stopped when I got back to the Nexus.) The same sound effect is used the underwater cavern, and in that case the exit script does fade out the sound so this workaround emulates that behaviour.
2011-05-17SCUMM: Make REDUCE_MEMORY_USAGE slightly more effecive (saving ~1kb ram)Max Horn
2011-05-14SCUMM: Remove some unused var warnings (see bug #3293800)Max Horn
2011-05-13SCUMM: Turned ResTypeData into a Common::Array<Resource>, subsuming its ↵Max Horn
_resource member
2011-05-13SCUMM: Remove ResTypeData::_numMax Horn
2011-05-13SCUMM: Add a Resource class, refactor res code around itMax Horn
2011-05-13SCUMM: Rename ResTypeData::num to _numMax Horn
2011-05-13SCUMM: Get rid of the MemBlkHeader hackMax Horn
This uncovered at least one potentially serious bug in the inventory code, which still needs to be investigated and fixed.
2011-05-13SCUMM: Refactor how resource (types) are srepresentedMax Horn
Previously, we had a couple of arrays of size N (where N = number of resource types), one for each attribute of a resource type (such as as the number of resources of that type. Now, we have one array of size N, whose elements are a record aggregating all the attributes of each resource type.
2011-05-12GIT: Clean up: Suppress SVN tags, now uselessstrangerke
2011-04-12COMMON: Replace MKID_BE by MKTAGMax Horn
MKID_BE relied on unspecified behavior of the C++ compiler, and as such was always a bit unsafe. The new MKTAG macro is slightly less elegant, but does no longer depend on the behavior of the compiler. Inspired by FFmpeg, which has an almost identical macro.
2011-04-05SCUMM: CleanupMax Horn
2011-04-05SCUMM: Fix off-by-one mistakes in out-of-bounds checks; name some constantsMax Horn
2011-04-04SCUMM: Check for cutSceneStackPointer underflowsMax Horn
2010-11-01ENGINES: Replace many printfs by warning/debug/debugNMax Horn
svn-id: r54031
2010-10-18SCUMM: Fix potential bug in ScummEngine::resStrLen.Max Horn
In particular, it might happen that ScummEngine::resStrLen is called while the _scriptPointer is stale. In that case, it would be working with the stale pointer. If the code calling it then uses fetchScript*() methods to read the string whose length was just computed, then it would read potentially *different* data (e.g. copyScriptString or loadPtrToResource could have been affected). I am not sure if this actually could have caused bugs somewhere; it might even be provable that a script relocation cannot happen in all places that invoke resStrLen. But for now it's much easier to make the code safe than to verify that theory ;). Also simplified some related code. svn-id: r53572
2010-10-18SCUMM: Move common code from ScummEngine::fetchScript* to new method.Max Horn
The new method is called refreshScriptPointer(). Also renamed getScriptEntryPoint() to resetScriptPointer() in an attempt to highlight both the similarity and difference between the two. svn-id: r53571
2010-08-16SCUMM: Move setResult/getResultPos to script_v5.cppMax Horn
svn-id: r52129
2010-08-11SCUMM: _resultVarNumber and related methods are specific to v0-v5Max Horn
svn-id: r51974
2010-01-28Fix regressions in Let's Explore the Jungle with Buzzy.Travis Howell
svn-id: r47622