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 ):
(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?):
(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?):
(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.