aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine/object.h
AgeCommit message (Collapse)Author
2018-08-25SCI32: Remove reg32_t and use reg_t in all casesFilippos Karapetis
reg32_t was a transitive solution, before reg_t's were adapted to use 32-bit addresses internally, and before support for SCI3 was added. It was introduced as another way to handle large script offsets in SCI3, and was only used for the program counter (PC). It's no longer needed, as we now support SCI3 script offsets using reg_t's, so we can use make_reg32 in all cases where we need to access offsets over 64KB
2017-10-06SCI32: Clean up ScreenItemColin Snover
* Rewrap comments to 80 columns * Clarify comments where possible * Use smart pointers where appropriate
2017-07-15SCI: Fix up Object::_baseMethod implementationColin Snover
1. In SCI0/1, selectors and offsets in the method block are stored contiguously (all selectors, then all offsets), with a null separator between the two runs. All the later versions of SCI instead interleave selectors & offsets. Since these values are already being copied into a new array anyway, code for reading method selectors/offsets is now simplified by interleaving this data when it is written into _baseMethod for SCI0/1, so the same equation for retrieving method selectors/offsets can be used across all SCI versions. 2. In SCI1.1-2.1 branch, the method count was being copied into the first entry of the array, which meant that SCI1.1-2.1 had extra code for dealing with the fact that the first entry was not an entry. This has been fixed, and the extra code removed. 3. Data was being overread into _baseMethod in all games SCI0-2.1. (SCI0/1 had an extra magic value of 2, and SCI1.1-2.1 had an extra magic value of 3). Reviewing history, it's not clear why this happened, other than that it appears to have been introduced at 7b0760f1bc5c28abcede041a6e3930f84ff3d319. My best guess is that this was a confusion between byte count and record count, where the intent was to read an extra 2 bytes for the null separator in SCI0/1, but it actually read 2 records instead. (I do not have a guess on why SCI1.1 ended up with a 3.) This overreading has been removed.
2017-06-09SCI: Implement Serializable for ObjectColin Snover
2017-05-20SCI: Find and store the original static names of objectsColin Snover
See code comment in Object::init for more details. Fixes Trac#9780.
2017-05-20SCI: Refactor relocation codeColin Snover
This groundwork enables an object to look up its static name separately from the normal process that is used to populate Object::_variables when an object is first constructed. (The static name property needs to be able to be retrieved from objects inside of earlier save games whose name properties may have already been modified at runtime, so the code cannot simply pluck the value out of Object::_variables when they are first initialised and then persisted into the save game, as nice and easy as that would have been.) This commit also helps to clarify the situation with relocation tables in SCI1 games that start with a zero entry. Refs Trac#9780.
2017-05-20SCI: Stop making copies of ObjMap and remove related dead codeColin Snover
ObjMap owns Objects, so every time this map gets copied instead of referenced, it creates a copy of every single object in the associated script. This is expensive, and it breaks things like the `Object::syncBaseObject` call in savegame.cpp, which hasn't actually been doing anything since 58190c36b4cc84b3200239211d91b0291301db56 because it has been operating on copies.
2017-04-23SCI32: Exclude SCI3 code from compilation when SCI32 is disabledColin Snover
2017-04-23SCI32: Fix missing mustSetViewVisible data in cloned objectsColin Snover
This information comes directly from script data and is not modified at runtime, so it does not need to be persisted in save games, but does need to be set when reconstructing clones.
2017-04-23SCI32: Fix mustSetViewVisible for SCI3Colin Snover
In SCI2/2.1, variable indexes are used along with a range encoded in the interpreter executable to determine whether an object variable is a view-related variable. Operands to aTop, sTop, ipToa, dpToa, ipTos, and dpTos are byte offsets into an object, which are divided by two to get the varindex to check against the interpreter range. In SCI3, objects in game scripts contain groups of 32 selectors, and each group has a flag that says whether or not the selectors in that group are view-related. Operands to aTop, sTop, ipToa, dpToa, ipTos, and dpTos are selectors.
2017-04-23SCI: Fix support for 32-bit SCI3 script offsetsColin Snover
2017-04-23SCI: Replace mostly-unused flags property with a single booleanColin Snover
There does not appear to be any reason to use a bit field instead of a simple boolean for this one flag, since there are no other flags that need to be set on Object like this.
2017-04-23SCI: Improve documentation of Object classColin Snover
2017-04-23SCI: Convert Object to use Common::Array for SCI3Colin Snover
In SCI3, index-to-selector tables no longer exist in compiled object data (instead, the SCI3 VM uses selectors directly and object data contains a bit map of valid selectors). In ScummVM, the table is generated by Object::initSelectorsSci3 for compatibility with the design of the ScummVM SCI VM. For consistency, _baseVars is converted to use a standard container, which works for all SCI versions. The table for SCI3 property offsets is also changed to use a standard container instead of manually managing the memory with malloc/free.
2017-04-23SCI32: Hook up mustSetViewVisible for SCI3Colin Snover
2017-04-21SCI: Improve audio volume & settings sync codeColin Snover
This patch includes enhancements to the ScummVM integration with SCI engine, with particular focus on SCI32 support. 1. Fixes audio volumes syncing erroneously to ScummVM in games that modify the audio volume without user action (e.g. SCI1.1 talkies that reduce music volume during speech playback). Now, volumes will only be synchronised when the user interacts with the game's audio settings. This mechanism works by looking for a known volume control object in the stack, and only syncing when the control object is present. (Ports and planes were researched and found unreliable.) 2. Fixes audio syncing in SCI32 games that do not set game volumes through kDoSoundMasterVolume/kDoAudioVolume, like GK1, GK2, Phant1, and Torin. 3. Fixes speech/subtitles syncing in SCI32 games that do not use global 90, like LSL6hires. 4. Fixes in-game volume controls in SCI32 games reflecting outdated audio volumes when a change is made during the game from the ScummVM launcher. 5. Fixes SCI32 games that would restore volumes from save games or reset volumes on startup, which caused game volumes to be out-of-sync with ScummVM when started. 6. ScummVM integration code for audio sync has been abstracted into a new GuestAdditions class. This keeps the ScummVM- specific code all in one place, with only small hooks into the engine code. ScummVM integrated save/load code should probably also go here in the future. Fixes Trac#9700.
2017-03-27SCI: Implement bounds-checked reads of game resourcesColin Snover
2016-12-03SCI: Clean up some commentsColin Snover
2016-02-29SCI3: Collect bits for managing kInfoFlagViewVisibleLars Skovlund
2016-02-18SCI: Implement accurate renderer architecture for SCI32Colin Snover
2015-12-29SCI32: split up SCI2.1 into EARLY/MIDDLE/LATEMartin Kiewitz
- Detection works via signatures (couldn't find a better way) - new kString subcalls were introduced SCI2.1 LATE - kString now has signatures and is split via subcall table - kString fix, so that KQ7 doesn't crash, when starting a chapter - Sci2StringFunctionType removed, because no longer needed
2014-02-18SCI: Make GPL headers consistent in themselves.Johannes Schickel
2012-06-18SCI: Add setter/getter methods to reg_t'sFilippos Karapetis
No functionality change has been made with this commit. This avoids setting and getting the reg_t members directly, and is the basis of any future work on large SCI3 scripts (larger than 64KB)
2012-06-15SCI: _propertyOffsetsSci3 and classpos should be 32-bit integersFilippos Karapetis
These are needed for future handling of large SCI3 script files
2011-06-20ALL: Remove trailing whitespacesMax Horn
This tries to make our code a bit more compliant with our code formatting conventions. For future use, this is the command I used: git ls-files "*.cpp" "*.h" | xargs sed -i -e 's/[ \t]*$//'
2011-05-25SCI: Constify Object::_baseVarsMax Horn
This may have to be undone if we ever want to start free'ing _baseVars again.
2011-05-12GIT: Clean up: Suppress SVN tags, now uselessstrangerke
2011-04-28JANITORIAL: Reduce header dependencies in shared codeOri Avtalion
Some backends may break as I only compiled SDL
2010-12-21- SCI: Added code to free the _baseVars value in SCI3 as well. Both free() ↵Filippos Karapetis
operations have been commented out for now, as MSVC complains about heap corruption in SCI3 games - Code formatting fixes svn-id: r54991
2010-12-21Make Object::_baseMethod a Common::Array. This is intended to clean upLars Skovlund
the Object class, and it also plugs a leak. svn-id: r54986
2010-11-19SCI: Fixed commentFilippos Karapetis
svn-id: r54362
2010-11-19SCI: Moved the Object class in a separate fileFilippos Karapetis
svn-id: r54361