Author Topic: SCI1.1 Code Disambiguation  (Read 5965 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

SCI1.1 Code Disambiguation
« on: June 17, 2015, 01:47:42 PM »
EDIT: Maybe we should make another thread for Tutorial Game Script disambiguation?

I worked out some vague variables in the BorderWindow script. I managed to succeed in drawing a window to replicate KQ5 so I don't use the SQ5 code anymore, but here's what I had worked out before I abandoned it. The only thing I can't figure out is what temp1 in BorderWindow and temp0 in InsetWindow are for. Not surprising as they're both involved in bit calculations which always throw me right off. Here's the localproc_0203 procedure which I renamed to drawWindow. I just can't figure out what param13 represents, it's only used in the Graph(grFILL_BOX) command but it seems to take different values from SCI0's version of the command (it takes 7 values instead of SCI0's 8 ):

Code: [Select]
(procedure (drawWindow top left bottom right back topBordColor lftBordColor botBordColor rgtBordColor bevelWid shadowWid priority param13)
    (var oldPort, bevelWidCounter)
    = oldPort GetPort()
    SetPort(0)
    Graph(grFILL_BOX top left + bottom 1 + right 1 param13 back priority)
    = top (- top bevelWid)
    = left (- left bevelWid)
    = right (+ right bevelWid)
    = bottom (+ bottom bevelWid)
    Graph(grFILL_BOX top left + top bevelWid right param13 topBordColor priority)
    Graph(grFILL_BOX - bottom bevelWid left bottom right param13 botBordColor priority)
    = bevelWidCounter 0   
    (while (< bevelWidCounter bevelWid)
        Graph(grDRAW_LINE + top bevelWidCounter + left bevelWidCounter - bottom (+ bevelWidCounter 1) + left bevelWidCounter lftBordColor priority -1)
        Graph(grDRAW_LINE + top bevelWidCounter - right (+ bevelWidCounter 1) - bottom (+ bevelWidCounter 1) - right (+ bevelWidCounter 1) rgtBordColor priority -1)
        ++bevelWidCounter
    )
    (if (shadowWid)
        Graph(grFILL_BOX + top shadowWid right + bottom shadowWid + right shadowWid param13 0 priority)
        Graph(grFILL_BOX bottom + left shadowWid + bottom shadowWid right param13 0 priority)
    )
    SetPort(oldPort)
)

Here's the BorderWindow's open method (what's temp1?):

Code: [Select]
    (method (open)
        (var oldPort, temp1)
        SetPort(0)
        = temp1 1
        (if (<> priority -1)
            = temp1 (| temp1 $0002)
        )
        = lsTop (- top bevelWid)
        = lsLeft (- left bevelWid)
        = lsRight (+ (+ right bevelWid) shadowWid)
        = lsBottom (+ (+ bottom bevelWid) shadowWid)
        = type 128
        (super:open())
        drawWindow(top left bottom right back topBordColor lftBordColor botBordColor rgtBordColor bevelWid shadowWid priority temp1)
        = temp0 GetPort()
        SetPort(0)
        Graph(grUPDATE_BOX lsTop lsLeft lsBottom lsRight 1)
        SetPort(oldPort)
    )

And InsetWindow's open method (what's temp0?):

Code: [Select]
    (method (open)
        (var temp0, oldPort, theTop, theLeft, theBottom, theRight)
        = temp0 1
        (if (<> priority -1)
            = temp0 (| temp0 $0002)
        )
        = theTop top
        = theLeft left
        = theBottom bottom
        = theRight right
        = top (- top (+ bevelWid topBordHgt))
        = left (- left (+ bevelWid sideBordWid))
        = bottom (+ bottom (+ bevelWid botBordHgt))
        = right (+ right (+ bevelWid sideBordWid))
        = xOffset (+ bevelWid sideBordWid)
        = yOffset (+ bevelWid topBordHgt)
        (super:open())
        localproc_0203(theTop theLeft theBottom theRight insideColor topBordColor2 lftBordColor2 botBordColor2 rgtBordColor2 bevWid shadWid priority temp0)
        = oldPort GetPort()
        SetPort(0)
        Graph(grUPDATE_BOX - theTop bevWid - theLeft bevWid + theBottom bevWid + theRight bevWid 1)
        SetPort(oldPort)
    )

Much of this can also be copied into the ScollInsetWindow script.
« Last Edit: June 17, 2015, 02:30:52 PM by MusicallyInspired »


Brass Lantern Prop Competition

Offline troflip

Re: SCI1.1 Code Disambiguation
« Reply #1 on: June 17, 2015, 02:09:33 PM »
Hmm, I put your versions of the code in, and now the window backgrounds are all transparent.... we should probably continue this in the template game discussion thread.
param13 is the screens (VISUAL, CONTROL, PRIORITY)... work backward and you can figure out the temp vars

[edit:] ok, the problem is that you're assign 1 to oldPort instead of temp1. So temp1 is zero, which means it draws the background on no screens.
« Last Edit: June 17, 2015, 02:19:32 PM by troflip »
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: SCI1.1 Code Disambiguation
« Reply #2 on: June 17, 2015, 02:25:14 PM »
Ah probably forgot to copy and paste that part. I'll fix it. It worked for me before I changed my approach. Also, you can copy most of this for the ScrollInsetWindow script as well.

EDIT: Found what I did. I mixed up temp0 and temp1. One of them is oldPort but they're alternated between BorderWindow and InsetWindow. It's fixed now.
« Last Edit: June 17, 2015, 02:28:43 PM by MusicallyInspired »
Brass Lantern Prop Competition

Offline OmerMor

Re: SCI1.1 Code Disambiguation
« Reply #3 on: June 17, 2015, 03:20:49 PM »
I just can't figure out what param13 represents, it's only used in the Graph(grFILL_BOX) command but it seems to take different values from SCI0's version of the command (it takes 7 values instead of SCI0's 8 )

Looking in scummvm, there seem to be a single implementation for SCI0 - SCI1.1, which takes 8 parameters, and they are:
0-3: rect
4: colorMark
5: color
6: priority
7: control

Code: [Select]
reg_t kGraphFillBoxAny(EngineState *s, int argc, reg_t *argv) {
Common::Rect rect = getGraphRect(argv);
int16 colorMask = argv[4].toUint16();
int16 color = adjustGraphColor(argv[5].toSint16());
int16 priority = argv[6].toSint16(); // yes, we may read from stack sometimes here
int16 control = argv[7].toSint16(); // sierra did the same

g_sci->_gfxPaint16->kernelGraphFillBox(rect, colorMask, color, priority, control);
return s->r_acc;
}

Offline troflip

Re: SCI1.1 Code Disambiguation
« Reply #4 on: June 17, 2015, 03:27:24 PM »
http://sierrahelp.com/SCI/SCIStudio3Help/SCC/Kernel_Graph.html

As OmerMor said, 8 parameters. The last three are optional.

0-3: rect
4: which screens (combination of VISUAL | PRIORITY | CONTROL)
5: optional visual color
6: optional priority color
7: optional control color
Check out my website: http://icefallgames.com
Groundhog Day Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.046 seconds with 22 queries.