Commit Graph
133 Commits
Author SHA1 Message Date
Filippos Karapetis 9f1413b338 When deleting a list node, erase its references to predecessor and successor nodes. Fixes cases where game scripts could reference a list node after it was deleted (e.g. QFG1 intro, Longbow when exiting the cave). Some slight cleanup
svn-id: r50515
2010-06-30 07:18:43 +00:00
Max Horn 8ae9774a00 SCI: Turn more warnings into errors.
If one of these is triggered for you, you can add an exception to
the error, together with a comment explaining why this exception
is necessary. Ideally after verifying that the cause is a script
bug and not a bug in our code...

svn-id: r50442
2010-06-28 12:29:06 +00:00
Filippos Karapetis 4785e1fd3f Renamed some variables
svn-id: r50284
2010-06-25 19:09:19 +00:00
Filippos Karapetis 0fb5429318 Initialize the stack with 'S' or 's' characters, like SSCI does (ultimately, we should not change the stack again like we do in op_link - this is what Sierra is doing). Some cleanup
svn-id: r50207
2010-06-24 09:52:08 +00:00
Filippos Karapetis 01cb1cf011 Turned more warnings into errors, some cleanup
svn-id: r49990
2010-06-18 02:03:28 +00:00
Filippos Karapetis 39e77edbb7 Process kAddAfter with 4 parameters (Torin's Passage)
svn-id: r49976
2010-06-18 00:05:41 +00:00
Filippos Karapetis a4ac9347d4 Fixed regression from commit #49251, and added an explanation. Calls to kNewNode with 1 parameter are handled properly again. Fixes the demo of Phantasmagoria 1. Thanks to lskovlun and waltervn for spotting this
svn-id: r49638
2010-06-13 21:43:13 +00:00
Filippos Karapetis cc6f5eb3e4 Unified invokeSelector() and invokeSelectorArgv(), and removed the INV_SEL kludge. Also, removed the selectorInvocation parameter - if invokeSelector() fails, the error is in most cases unrecoverable, and the error description thrown covers all cases where kContinueOnInvalidSelector was used. This uncovered a bug too: in some places, non reg_t parameters were parsed
svn-id: r49564
2010-06-10 09:22:30 +00:00
Filippos Karapetis 67de5b1bd3 Mass renaming of selector-related functions, and removed some defines which were just cloaking functions with a different name
- GET_SEL32 -> readSelector
- GET_SEL32V -> readSelectorValue
- PUT_SEL32 -> writeSelector
- PUT_SEL32V -> writeSelectorValue
Also, changed some selector-related function names and variables to CamelCase

svn-id: r49317
2010-05-29 23:37:15 +00:00
Filippos Karapetis 2c2a1fa1ba Made _k_new_node() a method of the segment manager, and fixed a bug with the rarely used SCI0 kernel function kSort in the process (_k_new_node was called with key, value instead of value, key inside kSort)
svn-id: r49251
2010-05-26 22:05:51 +00:00
Max Horn 38bf3d0d3c SCI: Make EngineState parameter to INV_SEL explicit
svn-id: r48202
2010-03-08 21:54:07 +00:00
Max Horn 5e8743d0d6 SCI: Made some stuff static
svn-id: r48199
2010-03-08 20:12:17 +00:00
Walter van Niftrik a3a07f19fc SCI: Revert r47929 (bad idea, as we may run out of offsets). Instead, adapt SCI32 list iteration code to store node successor before invoking.
svn-id: r48036
2010-02-12 02:23:28 +00:00
Filippos Karapetis 788f375703 Added a sanity check for kListAt and made the hack for displaying text work in SCI2 only
svn-id: r47931
2010-02-06 16:12:19 +00:00
Max Horn f86618f92b SCI: Add a 'SELECTOR' macro
svn-id: r47918
2010-02-05 22:55:18 +00:00
Willem Jan Palenstijn 06bd17ee71 SCI: Remove extra '\n's in debugC messages
svn-id: r47707
2010-01-30 11:59:05 +00:00
Max Horn 4ffec28103 SCI: Move selector stuff to new header; reorder k_argc & k_argp param of invoke_selector
svn-id: r47665
2010-01-29 11:03:54 +00:00
Filippos Karapetis a83fca1430 kDisposeList() is not needed according to waltervn, as the garbage collector automatically clears unused objects
svn-id: r47653
2010-01-28 21:05:42 +00:00
Filippos Karapetis 3c46bc33aa Disabled the automatic list fixing feature, introduced in rev. #47636 (there's no point in fixing lists created by game scripts)
svn-id: r47650
2010-01-28 20:53:33 +00:00
Walter van Niftrik 639fb4c389 SCI: Cleanup
svn-id: r47649
2010-01-28 20:29:45 +00:00
Lars Skovlund 1ceaf34948 Handle calls to NewNode() with just one parameter.
Takes care of Phantasmagoria, Torin, etc.

svn-id: r47643
2010-01-28 15:01:28 +00:00
Filippos Karapetis a408a025b6 Since we fix the list problems inside isSaneNodePointer(), don't abort processing of the list
svn-id: r47637
2010-01-28 10:04:54 +00:00
Filippos Karapetis 383019c518 - The list checks now throw more verbose warnings
- Some obvious list problems are now fixed automatically when found, after the relevant warnings are shown
- kDisposeList now clears all the nodes in the list
- Some cleanup

svn-id: r47636
2010-01-28 09:49:54 +00:00
Filippos Karapetis b92a744a04 sane_nodep() and sane_listp() should not be dummy functions when DISABLE_VALIDATIONS is set, so that the engine doesn't try and refer to null pointer objects (and subsequently crash)
svn-id: r46956
2010-01-03 21:53:34 +00:00
Filippos Karapetis 781dd3b183 Fixed compilation with DISABLE_VALIDATIONS, and fixed a bug in kPrevNode
svn-id: r46949
2010-01-03 21:12:44 +00:00
Johannes Schickel fd2d0fc718 Formatting.
svn-id: r46755
2009-12-30 15:48:43 +00:00
Filippos Karapetis 6305dde687 Fixed warnings
svn-id: r46747
2009-12-30 15:01:54 +00:00
Filippos Karapetis 17454ee80f Initial implementation of the SCI21 kList kernel function (which calls all the other list-related functions), thanks to the help of waltervn
svn-id: r46744
2009-12-30 14:31:00 +00:00
Filippos Karapetis d8b67ed7c6 SCI32: Moved all the list related kernel functions inside klists.cpp, and implemented kListAllTrue with the help of waltervn
svn-id: r46742
2009-12-30 14:00:30 +00:00
Max Horn f3ab3051d8 SCI: Make the implicit segMan param to GET_SEL32(V) and PUT_SEL32(V) explicit
svn-id: r45234
2009-10-18 19:42:56 +00:00
Max Horn 2e964baeef Some const correctness changes; cleanup
svn-id: r44850
2009-10-09 21:47:33 +00:00
Max Horn 0988e273ec SCI: Turn lookup_node & lookup_list into SegManager::lookupNode & SegManager::lookupList
svn-id: r44769
2009-10-07 23:34:24 +00:00
Max Horn 6ad5840181 SCI: Rename EngineState::segMan to _segMan
svn-id: r44629
2009-10-04 18:38:18 +00:00
Max Horn 01176782ea Fix some cppcheck warnings reported by salty-horse
svn-id: r44538
2009-10-02 14:32:54 +00:00
Filippos Karapetis 86016e4dc5 Changed the list sanity checks to return warnings instead of errors in case of failure - apparently, this can occur in some games, e.g. Longbow and QFG1
svn-id: r44503
2009-09-30 22:54:00 +00:00
Filippos Karapetis f9296a6445 - Changed the unimplemented debug SCI kernel functions (InspectObj, ShowSends, ShowObjs, ShowFree, StackUsage and Profiler) to be dummy functions - we have our own debugger, and don't use these functions for debugging
- Removed the function number parameter from all kernel functions, as it's no longer needed, and removed the FAKE_FUNCT_NR hack
- Removed kUnknown() and kStub()
- Dummy/unknown kernel functions are no longer invoked, and a warning is shown instead, with the paremeters passed to them

Note: there is an evil hack used for debugging scripts in invoke_selector(), which probably no longer works now

svn-id: r44461
2009-09-29 14:24:07 +00:00
Max Horn 9651562e72 SCI: Rename WAS_FUNCT_NR to FAKE_FUNCT_NR; turn some #defines into enums
svn-id: r44169
2009-09-17 16:49:31 +00:00
Max Horn 10f898c90e SCI: Rename MemObject -> SegmentObj
svn-id: r44130
2009-09-17 00:45:12 +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
Max Horn d04b5d2c9b SCI: Rename resManager -> resMan; segManager -> segMan
svn-id: r43980
2009-09-06 12:57:42 +00:00
Filippos Karapetis 1bbab8f191 Some renaming:
getresourceManager -> getResourceManger
resourceManager -> resMan
segmentManager ->segMan

svn-id: r43908
2009-09-02 12:02:37 +00:00
Max Horn 6c44eafa97 SCI: funct_nr is not used in 99% of all opcodes -- hide it in those (to be removed eventually)
svn-id: r43905
2009-09-02 11:33:25 +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
Joost Peters 6a3c595b01 remove \n's from error() calls
svn-id: r43571
2009-08-20 21:03:03 +00:00
Max Horn f08f5c3bbf SCI: Slightly modified kAddAfter so that it does not modify its arguments needlessly
svn-id: r41174
2009-06-04 20:51:24 +00:00
Filippos Karapetis 780926991e Moved some more console commands to ScummVM's debug console
svn-id: r41126
2009-06-02 19:03:43 +00:00
Filippos Karapetis c730e0290d Replaced kernel_oops with error(), and added an enum to clarify the cases where invoke_selector should stop
svn-id: r41095
2009-06-01 08:00:58 +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