Author Topic: Customized Dialogue Windows  (Read 23 times)

0 Members and 1 Guest are viewing this topic.

Offline NilG

Customized Dialogue Windows
« on: Yesterday at 10:56:08 AM »
Hi again.  Most of the code for the demo is done (act 1 of a 3 act game).  Still a ton to do, replace edited Sierra backgrounds with original ones, add and pretty up some views, clean up some code (aside from a bit of scripting and the C++ courses I took in high school 20 years ago, I'm not a programmer), and waaaaay too many "responseless" possibilities.  Still, there are two complete positive paths through the end of the section I have, it's been amazingly rewarding, and thank you so much for the help with my absolute beginner's questions.

One thing that isn't necessary, but I'd love to include, and I realize it may require a ton of rewrites or additions, is customized dialogue boxes for conversation, similar to QfG2.  Basically just background and text colors customized depending on who's speaking.  Snail Trek (love it and looking forward to Cascadia Quest) also has something very similar; I don't know that speech bubbles would fit stylistically here, but it is basically that idea.

I've looked at the code and guess what's there can be used to implement this, but as a non-coder, my method for doing so would probably be super convoluted.  Is there any kind of built-in method for the customization of dialogue boxes, or a sample of code that doesn't suck for doing so?  I can certainly add sucky code, but I know many of you have been here for a long time doing these things, so figured I'd ask before tromping ahead recklessly.  :D  Thanks!



Offline Kawa

Re: Customized Dialogue Windows
« Reply #1 on: Yesterday at 03:18:22 PM »
It's interesting that you'd specify Quest for Glory 2, since that game already had a concept of a Talker. Assuming you want an SCI11 game, you could suffice by simply giving each of your characters' Talker instances different color and back values. It seems to already be all set up to pass these values along to a clone of gWindow. That means the only thing preventing these colors from showing up correctly is that the SCI11 template's gWindow is a BorderWindow by default. If you were to change this to a SysWindow (look for instance mainWindow of BorderWindow in Main.sc), that'd simplify things a lot and you get title bars back.

As for how custom window frames work in general... basically just like how a BorderWindow does it. Instead of letting the interpreter draw the window, they set the Custom bit ($80) and draw it themselves.

Here's the custom window frame from The Colonel's Bequest, with my annotations, as an example:
Code: [Select]
(class myWindow of SysWindow
(properties
top 0
left 0
bottom 0
right 0
color 15
back 8
priority -1
window 0
type $0081 ;Custom, no save
title 0
brTop 0
brLeft 0
brBottom 190
brRight 320
underBits 0
)

(method (dispose)
(SetPort 0)
(Graph grRESTORE_BOX underBits)
(Graph grREDRAW_BOX (- top 8) (- left 8) (+ bottom 8) (+ right 8))
(DisposeWindow window)
(DisposeClone self)
)

(method (open &tmp screens t l b r trHeight blHeight tlHeight tlWidth)
(= tlHeight (CelHigh 657 0 0))
(= trHeight (CelHigh 657 0 1))
(= blHeight (CelHigh 657 1 0))
(= tlWidth (CelWide 657 0 0))
(SetPort 0)

; Make room for the corners
(= t (- top 8))
(= l (- left 8))
(= b (+ bottom 8))
(= r (+ right 8))

(= screens VISUAL)
(if (!= priority -1) (= screens (| screens PRIORITY)))

;We've set the No Save bit, so the kernel won't do it for us.
(= underBits (Graph grSAVE_BOX t l b r screens))

;Fill in the box to start with.
(Graph grFILL_BOX t l b r screens back priority)

;Draw the corners
(DrawCel 657 0 0 l t -1)
(DrawCel 657 0 1 l (- b trHeight) -1)
(DrawCel 657 1 0 (- r blHeight) t -1)
(DrawCel 657 1 2 (- r blHeight) (- b trHeight) -1)

;Draw the double edges
(Graph grDRAW_LINE t (+ l tlWidth) t (- r tlWidth) 31 -1 -1) ;top
(Graph grDRAW_LINE (+ t 2) (+ l tlWidth) (+ t 2) (- r tlWidth) 31 -1 -1)
(Graph grDRAW_LINE (- b 1) (+ l tlWidth) (- b 1) (- r tlWidth) 31 -1 -1) ;bottom
(Graph grDRAW_LINE (- b 3) (+ l tlWidth) (- b 3) (- r tlWidth) 31 -1 -1)
(Graph grDRAW_LINE (+ t tlHeight) l (- b tlHeight) l 31 -1 -1) ; left
(Graph grDRAW_LINE (+ t tlHeight) (+ l 2) (- b tlHeight) (+ l 2) 31 -1 -1)
(Graph grDRAW_LINE (+ t tlHeight) (- r 1) (- b tlHeight) (- r 1) 31 -1 -1) ;right
(Graph grDRAW_LINE (+ t tlHeight) (- r 3) (- b tlHeight) (- r 3) 31 -1 -1)

;Make sure we can see it on screen.
(Graph grREDRAW_BOX t l b r 1)

;Make sure we're still (| Custom NoSave)
(= type $81)

;Let the kernel worry about the rest
(super open:)
)
)


SMF 2.0.14 | SMF © 2017, Simple Machines
Simple Audio Video Embedder

Page created in 0.099 seconds with 24 queries.