243 Commits

Author SHA1 Message Date
Willem Jan Palenstijn
08e4d96a7d SCI: clear strcpy's dest string if src is invalid.
This fixes moving the plank at the start of KQ6 in Text mode.

svn-id: r44397
2009-09-27 13:05:50 +00:00
Willem Jan Palenstijn
77751a0455 SCI: change segment offsets in reg segments to be in half reg_t.
This makes offsets in raw and reg segments consistent, which
fixes string addressing in savegame dialogs.

svn-id: r44396
2009-09-27 12:23:14 +00:00
Willem Jan Palenstijn
5d2d8c580a SCI: Add utility functions for copying data between raw/non-raw segments
svn-id: r44387
2009-09-27 01:49:56 +00:00
Filippos Karapetis
13ad217cdd - Moved the SCI version in a global variable
- Changed all the SCI version checks to use getSciVersion()
- Also made getSciVersionDesc a global function (removes some ugly accessing of the SCI engine)

The fallback detector should work correctly now

svn-id: r44269
2009-09-23 10:55:35 +00:00
Filippos Karapetis
5184f86e15 - Merged scriptObjInit0() and scriptObjInit11()
- Replaced some cases where getSciVersion() is used with _resMan->sciVersion(), as getSciVersion() will fail with the fallback detector (as the engine is not initialized). Object property accessors still crash currently, when used with the fallback detector

svn-id: r44261
2009-09-22 14:33:46 +00:00
Max Horn
6424a1e9e2 SCI: Add some FIXMEs, and print warning if accessing a raw segment as non-raw or vice versa
svn-id: r44245
2009-09-22 00:51:55 +00:00
Max Horn
5f5ab54810 SCI: Add new type SegmentRef which ultimately will allow us to distinguish between raw and 'reg_t' memory blocks in client code
svn-id: r44244
2009-09-22 00:36:24 +00:00
Max Horn
5fc2428c99 SCI: SegmentObj's now set their type in constructor; replace central SegmentObj::createSegmentObj call in SegManager::allocSegment by several explicit 'new' statements; some extra cleanup
svn-id: r44242
2009-09-22 00:35:46 +00:00
Max Horn
d2a6713a8e SCI: Replace IntMapper Script::_objIndices and Common::Array Script::_objects by a HashMap -- goodbye, class IntMapper
svn-id: r44240
2009-09-21 21:38:43 +00:00
Max Horn
57dfb9bafd SCI: Rename Object::flags and pos to _flags and _pos; tweak scriptObjInit0 and scriptObjInit11 to be more similar
svn-id: r44234
2009-09-21 21:35:43 +00:00
Max Horn
eb77efda78 SCI: Add a global getSciVersion() function and make use of it
svn-id: r44170
2009-09-17 16:50:53 +00:00
Filippos Karapetis
f890a69428 Changed the way object selectors are accessed, by removing the relevant defines and adding appropriate methods to the Object structure
svn-id: r44138
2009-09-17 08:51:38 +00:00
Max Horn
280bee663e SCI: Change SegmentId from int to uint16; consistently use segment 0 to indicate an invalid segment
svn-id: r44131
2009-09-17 00:46:01 +00:00
Max Horn
10f898c90e SCI: Rename MemObject -> SegmentObj
svn-id: r44130
2009-09-17 00:45:12 +00:00
Max Horn
1f0e8ef470 SCI: More cleanup
svn-id: r44129
2009-09-17 00:44:22 +00:00
Max Horn
68dfdce043 SCI: Turn some SegManager methods into Script methods
svn-id: r44127
2009-09-16 23:32:48 +00:00
Max Horn
a277123f54 SCI: Rename Script class members, change Script from struct to class
svn-id: r44126
2009-09-16 23:32:27 +00:00
Max Horn
bfe1538715 SCI: Misc cleanup
svn-id: r44093
2009-09-14 22:34:53 +00:00
Max Horn
8ac3db0801 SCI: Rename SegManager::kernelDeref*() methods to SegManager::deref*()
svn-id: r44083
2009-09-14 13:27:09 +00:00
Max Horn
0e834d0b87 SCI: kernelDeref*() functions are now seSegmentManager methods
svn-id: r44082
2009-09-14 13:13:20 +00:00
Filippos Karapetis
18b24da384 Removed the INST_LOOKUP_CLASS define
svn-id: r44043
2009-09-12 18:22:32 +00:00
Filippos Karapetis
90ae20c3ea - Made obj_get and obj_get_name methods of SegManager (getObject and getObjectName, respectively)
- Renamed alloc_List -> allocateList, alloc_Node->allocateNode, alloc_hunk_entry->allocateHunkEntry, free_hunk_entry->freeHunkEntry, for consistency

svn-id: r44039
2009-09-12 00:10:07 +00:00
Filippos Karapetis
e3a733f2e2 Fixed a regression from commit #43999 (segment ID 1 is valid)
svn-id: r44000
2009-09-07 08:27:49 +00:00
Max Horn
44b60d2750 SCI: Replace GET_SEGMENT_ANY and GET_OBJECT_SEGMENT macros by new segman methods
svn-id: r43999
2009-09-07 06:07:18 +00:00
Max Horn
eb8cf07db2 SCI: Rename SegManager::exports_wide to _exportsAreWide and changed it to a bool, and rename setExportWidth() to setExportAreWide()
svn-id: r43988
2009-09-06 13:01:26 +00:00
Max Horn
fdaa3d423c SCI: Script::obj_indices is now protected
Add new methods init, allocateObject and getObject to class Script, and use them instead of directly accessing Script::obj_indices. Replace RAW_GET_CLASS_INDEX with Script::getObject()

svn-id: r43987
2009-09-06 13:01:00 +00:00
Max Horn
a550e2ea10 SCI: Replace "IntMapper *id_seg_map" in SegManager with a Common::HashMap<int,int>
This simplifies the code considerably. Also changed the savegame format
accordingly, which required me to bump the format version to 10. Old
saves should still load fine.

svn-id: r43986
2009-09-06 13:00:30 +00:00
Max Horn
b51e9988e6 SCI: cleanup
svn-id: r43982
2009-09-06 12:58:43 +00:00
Max Horn
fdbb167ea3 SCI: Cleanup for some SegManager internals
- rename segGet and getSegment to getScriptSegment; the two can be
  distinguished by the parameter count.
- rename type SCRIPT_GET to ScriptLoadType to conform with our code
  formatting conventions
- rename get_class_address to getClassAddress
- some cleanup

svn-id: r43981
2009-09-06 12:58:16 +00:00
Sven Hesse
4b4b36cfb1 Fixing signed/unsigned comparison warning
svn-id: r43937
2009-09-04 08:37:53 +00:00
Filippos Karapetis
142922387c Moved some functions inside the SegManager class, and renamed alloc_clone() to allocateClone()
svn-id: r43935
2009-09-04 07:17:34 +00:00
Filippos Karapetis
1bbab8f191 Some renaming:
getresourceManager -> getResourceManger
resourceManager -> resMan
segmentManager ->segMan

svn-id: r43908
2009-09-02 12:02:37 +00:00
Matthew Hoops
b5da8a5cdc - Split SCI_VERSION_32 into SCI_VERSION_2, SCI_VERSION_2_1, and SCI_VERSION_3 (each version has a different kernel table).
- Improve map detection.
- Fix SCI32 object and script initialization (Torin's Passage and GK1 scripts now start up, and probably most SCI2/2.1 games).
- Add SCI2 and SCI2.1 kernel tables.

svn-id: r43742
2009-08-25 23:02:57 +00:00
Filippos Karapetis
ac025f4294 - Replaced more cases of EngineState parameters
- Made some version comparisons for old SCI0 versions easier to read
- Removed the GET_SEL32SV macro

svn-id: r43729
2009-08-25 15:14:29 +00:00
Filippos Karapetis
ed66cad677 - Simplified the parameters of some functions
- Replaced some EngineState parameters
- The SCI version is now obtained from the resource manager or the segment manager, thereby simplifying several functions
- Plugged 2 leaks in the fallback detector
- Renamed the segment manager and resource manager to "segmentManager" and "resourceManager" in all places, for consistency

svn-id: r43722
2009-08-25 08:38:14 +00:00
Walter van Niftrik
7359c8f968 SCI: Read class table from vocab resource instead of scanning. This fixes
several "invalid selector" VM crashes caused by duplicate classes.

svn-id: r43680
2009-08-24 01:59:58 +00:00
Filippos Karapetis
60af2db2fd - Added more mappings from Sierra's internal IDs to our own ones. Hopefully, all SCI0-SCI11 games can now be detected correctly from the fallback detector
- Simplified some checks for old script types

svn-id: r43678
2009-08-23 21:57:30 +00:00
Joost Peters
6a3c595b01 remove \n's from error() calls
svn-id: r43571
2009-08-20 21:03:03 +00:00
Filippos Karapetis
ca9bbce9b3 - Added game ID detection to the fallback detector. We still need to map some of Sierra's internal IDs to our own ones
- The class table is now created in the segment manager constructor

svn-id: r43504
2009-08-18 10:01:18 +00:00
Filippos Karapetis
c38f58598b - Simplified some functions to accept only the parts of the EngineState they need as parameters, instead of the whole EngineState
- Moved the class table in the Segment manager - it's the only class using it directly
- Removed the sci11 flag from save games (we already know this, we don't need to store it)
- Moved script_get_segment() and get_class_address() inside the segment manager class
- Removed the script_locate_by_segment wrapper
- Simplified script_lookup_export() a lot by removing some paranoia checks
- Added some WIP code for automatically determining the game id in the fallback detector (still not working)
- General cleanup

svn-id: r43458
2009-08-17 05:55:21 +00:00
Max Horn
50cd2750cc SCI: Avoid using perror (it's not portable)
svn-id: r42866
2009-07-28 22:28:40 +00:00
Filippos Karapetis
31a0c80905 Moved the kernel and the vocabulary outside of the engine state (they're static data, which never changes during a game)
svn-id: r42398
2009-07-11 23:45:54 +00:00
Filippos Karapetis
d55f7e72d0 Added auto-detection for games with older headers for script blocks, and removed game flag GF_SCI0_OLD
svn-id: r42211
2009-07-07 10:28:05 +00:00
Filippos Karapetis
522b161bec Replaced sciprintf() calls with printf, DebugPrintf, warning and error calls
svn-id: r42167
2009-07-06 10:39:22 +00:00
Max Horn
42de7a1573 Patch
svn-id: r41647
2009-06-18 22:09:57 +00:00
Walter van Niftrik
a6ed05740f SCI: Moved resource36 handling into resource manager.
svn-id: r41349
2009-06-07 19:15:55 +00:00
Max Horn
10c54394bd SCI: Renamed EngineState::flags and version to _flags and _version (following our conventions); also slightly changed the EngineState constructor to init _version & _flags, and used this to make them constant
svn-id: r41177
2009-06-04 21:44:39 +00:00
Max Horn
6b1110b82d SCI: Moved MemObject code into a separate source file
svn-id: r41166
2009-06-04 11:45:17 +00:00
Filippos Karapetis
e55388c787 Removed script_error_flag and script_debug_flag, which were used to error out if something went wrong and open the debugger console. Changed all the places where they were used to error() out instead, as ScummVM's debugger console can open on error()
svn-id: r41073
2009-05-31 15:34:23 +00:00
Torbjörn Andersson
0999534749 The error() and warning() functions add ! and newline automatically. (I didn't
look at debug() and debugC(), since I'm really bored with this now. :-)

svn-id: r41061
2009-05-31 10:02:16 +00:00