Difference between revisions of "SCI/Specifications/SCI virtual machine/Kernel functions"

Jump to navigation Jump to search
m
behaviour -> behavior
(Fixed formatting, converted math formulas to images)
m (behaviour -> behavior)
 
(6 intermediate revisions by 3 users not shown)
Line 147: Line 147:
</ol>
</ol>


The animation is executed when kAnimate() (see KAnimateSection [*]) is invoked. If not specified, it is assumed to be the same animation as last time.
The animation is executed when kAnimate() (see (see [[SCI/Specifications/SCI_in_action/Views_and_animation_in_SCI|Views and animation in SCI]] section) is invoked. If not specified, it is assumed to be the same animation as last time.
(word) Flags:
(word) Flags:


Line 188: Line 188:
Returns: (void)<br>
Returns: (void)<br>


This function draws a background picture plus some views to the foreground. If the background picture had not been drawn previously, it is animated with the animation style set during kDrawPic (see section Kernel function 0x08). Drawing the views is a rather complex issue. Refer to Views and animation in SCI section for its description.
This function draws a background picture plus some views to the foreground. If the background picture had not been drawn previously, it is animated with the animation style set during kDrawPic (see section [[SCI/Specifications/SCI_virtual_machine/Kernel_functions#Kernel_function_0x08:_DrawPic.28word.5B.2C_word.2C_word.2C_word.5D.29|Kernel function 0x08]]). Drawing the views is a rather complex issue. Refer to [[SCI/Specifications/SCI in action/Views and animation in SCI|Views and animation in SCI]] section for its description.


===Kernel function 0x0c: <tt>SetNowSeen(DblList)</tt>===
===Kernel function 0x0c: <tt>SetNowSeen(DblList)</tt>===
Line 226: Line 226:
Returns: (word) The width of the cel identified by the tuple (view, loop, cel).<br>
Returns: (word) The width of the cel identified by the tuple (view, loop, cel).<br>


===Kernel function 0x0f: CelWide(word view, word loop, word cel)===
<syntax type="C">kfunct 0x10: CelHigh();
word view, word loop, word cel;</syntax>
(HeapPtr) <tt>view:</tt> The view we're searching in <tt>loop:</tt> The loop the cel is contained in <tt>cel:</tt> The cel we're interested in<br>


Returns: (word) The height of the cel identified by the tuple (view, loop, cel).<br>


===Kernel function <tt>0x11: DrawCel(word, word, word, Point, word)</tt>===
===Kernel function <tt>0x11: DrawCel(word, word, word, Point, word)</tt>===
Line 256: Line 250:
Returns: (void)<br>
Returns: (void)<br>


This function stores the list of PicViews for later use by the Animate() syscall. See Kernel function 0x0b section for more details.
This function stores the list of PicViews for later use by the Animate() syscall. See [[SCI/Specifications/SCI_virtual_machine/Kernel_functions#Kernel_function_0x0b:_Animate.28.5BDblList.5D.2C_.5Bword.5D.29|Kernel function 0x0b]] section for more details.


===Kernel function 0x13: NewWindow(Rect, HeapPtr, word, word, word, word)===
===Kernel function 0x13: NewWindow(Rect, HeapPtr, word, word, word, word)===
Line 278: Line 272:
Returns: (HeapPtr): The position of the window structure on the heap<br>
Returns: (HeapPtr): The position of the window structure on the heap<br>


This function creates a window (see also Windows, Dialogs and Controls section), sets this window as the active port, draws the window (if neccessary), and returns with the window's heap address.
This function creates a window (see also [[SCI/Specifications/Graphics/Windows, Dialogs and Controls|Windows, Dialogs and Controls]] section), sets this window as the active port, draws the window (if neccessary), and returns with the window's heap address.


===Kernel function 0x14: GetPort()===
===Kernel function 0x14: GetPort()===
Line 316: Line 310:
Returns: (void)<br>
Returns: (void)<br>


This function draws a Control (see Windows, Dialogs and Controls section for details). Please note that the correct port must be selected beforehand.
This function draws a Control (see [[SCI/Specifications/Graphics/Windows, Dialogs and Controls|Windows, Dialogs and Controls]] section for details). Please note that the correct port must be selected beforehand.


===Kernel function 0x18: HiliteControl(HeapPtr)===
===Kernel function 0x18: HiliteControl(HeapPtr)===
Line 337: Line 331:
Returns: (void)<br>
Returns: (void)<br>


This function will apply the event provided to edit a type 3 (Edit window) Control (see Windows, Dialogs and Controls section for a description of the control system). Normal keypresses are added to the area pointed to by Control::text, unless the total string length would be greater than Control::max. Cursor keys, backspace and a few other keys may be used to manipulate the control. In FreeSCI, some of the libreadline control keys can be used to edit and move the cursor as well. If it is called to edit a Control which is not of type 3, it returns without error. Please note that the correct port (usually the window which the Control was drawn in) must be selected beforehand.
This function will apply the event provided to edit a type 3 (Edit window) Control (see [[SCI/Specifications/Graphics/Windows, Dialogs and Controls|Windows, Dialogs and Controls]] section for a description of the control system). Normal keypresses are added to the area pointed to by Control::text, unless the total string length would be greater than Control::max. Cursor keys, backspace and a few other keys may be used to manipulate the control. In FreeSCI, some of the libreadline control keys can be used to edit and move the cursor as well. If it is called to edit a Control which is not of type 3, it returns without error. Please note that the correct port (usually the window which the Control was drawn in) must be selected beforehand.


===Kernel function 0x1a: TextSize(HeapPtr, HeapPtr, word[, word])===
===Kernel function 0x1a: TextSize(HeapPtr, HeapPtr, word[, word])===
Line 600: Line 594:
* The heap status is reset, but the heap is not cleared
* The heap status is reset, but the heap is not cleared


After this is done, the engine restarts at a certain point (see Interpreter initialization and the main execution loop section for more details), re-initializes the stack, and executes the replay method of the game object.
After this is done, the engine restarts at a certain point (see [[SCI/Specifications/SCI virtual machine/Interpreter initialization and the main execution loop|Interpreter initialization and the main execution loop]] section for more details), re-initializes the stack, and executes the replay method of the game object.


===Kernel function 0x30: GameIsRestarting()===
===Kernel function 0x30: GameIsRestarting()===
Line 771: Line 765:
Stops all music and sound effects.<br>
Stops all music and sound effects.<br>


==Kernel function 0x32: NewList()===
===Kernel function 0x32: NewList()===
<syntax type="C">kfunct 0x32: NewList();</syntax>
<syntax type="C">kfunct 0x32: NewList();</syntax>


Line 968: Line 962:
Returns: (word) Either the time of day in seconds, or the elapsed number of ticks since the interpreter started.<br>
Returns: (word) Either the time of day in seconds, or the elapsed number of ticks since the interpreter started.<br>


This function is somewhat strange, because it determines its behaviour not by the value of a parameter passed, but by its presence instead. Please note that the time of day in this case does not distinguish between am and pm.
This function is somewhat strange, because it determines its behavior not by the value of a parameter passed, but by its presence instead. Please note that the time of day in this case does not distinguish between am and pm.


===Kernel function 0x47: StrEnd(HeapPtr)===
===Kernel function 0x47: StrEnd(HeapPtr)===
Line 1,116: Line 1,110:
If both conditions are met, 1 is returned. Otherwise, 0 is returned.
If both conditions are met, 1 is returned. Otherwise, 0 is returned.


===Kernel function 0x52: OnControKword, Point | Rect)===
===Kernel function 0x52: OnControl(word, Point | Rect)===
<syntax type="C">kfunct 0x52: OnControl();
<syntax type="C">kfunct 0x52: OnControl();
word map, Point|Rect area;</syntax>
word map, Point|Rect area;</syntax>
Line 1,125: Line 1,119:
Returns: (word) The resulting bitfield<br>
Returns: (word) The resulting bitfield<br>


This function scans the indicated point or area on the specified map, and sets the bit corresponding to each color value found correspondingly. For example, if scanning map 4 (special) would touch two areas, one with color value 1 and one with color value 10, the resulting return value would be 0x0402 (binary 0000010000000010). See also "Pictures and movement control" section.
This function scans the indicated point or area on the specified map, and sets the bit corresponding to each color value found correspondingly. For example, if scanning map 4 (special) would touch two areas, one with color value 1 and one with color value 10, the resulting return value would be 0x0402 (binary 0000010000000010).  
 
See also "[[SCI/Specifications/Graphics/Pictures and movement control|Pictures and movement control]] section.


===Kernel function 0x53: InitBresen(HeapPtr [, word])===
===Kernel function 0x53: InitBresen(HeapPtr [, word])===
2,051

edits

Navigation menu