Function setGraphics(width, height) For depth = 32 To 16 Step -8 If GfxModeExists(width, height, depth) Graphics width, height, depth Return EndIf Next End Function Function askWithQuote(question$) maxLen = 80 keyY = 21 keyN = 49 SetBuffer BackBuffer() randomQuote = Int(Rnd#(1, getQuoteCount() / 2 - 2)) Restore quotes For i = 1 To randomQuote * 2 Read temp$ Next Read line1$ Read line2$ line2$ = "- " + line2$ If Len(line1$) > maxLen Then lastLetter = -1 For i = maxLen To 1 Step -1 If lastLetter = -1 letter$ = Mid$(line1$, i, 1) If letter$ = " " Or letter$ = "," Or letter$ = "." Or letter$ = "?" lastLetter = i Exit EndIf EndIf Next If lastLetter <> -1 Then line1a$ = Left$(line1$, lastLetter) line1b$ = Mid$(line1$, lastLetter + 1) shadePrint screenHeight / 2 - 100, line1a$, False, 16, paletteMax shadePrint screenHeight / 2 - 80, line1b$, False, 16, paletteMax shadePrint screenHeight / 2 - 60, line2$, False, 16, paletteMax EndIf Else shadePrint screenHeight / 2 - 100, line1$, False, 16, paletteMax shadePrint screenHeight / 2 - 80, line2$, False, 16, paletteMax End If shadePrint screenHeight / 2, question$, False, 24, paletteMax shadePrint screenHeight / 2 + 30, "[Y]es/ [N]o", False, 20, paletteMax Flip While Not (pressedY Or pressedN) pressedY = KeyDown(keyY) pressedN = KeyDown(keyN) Wend Return pressedY End Function Function getQuoteCount() Restore quotes Repeat Read thisData$ maxDataLines = maxDataLines + 1 Until thisData$ = "" quoteCount = maxDataLines - 1 Return quoteCount End Function Function ask(question$) keyY = 21 keyN = 49 SetBuffer BackBuffer() shadePrint screenHeight / 2, question$, False, 24, paletteMax shadePrint screenHeight / 2 + 30, "[Y]es/ [N]o", False, 20, paletteMax Flip While Not (pressedY Or pressedN) pressedY = KeyDown(keyY) pressedN = KeyDown(keyN) Wend Return pressedY End Function Function shadePrint(y, t$, threeD, fontSize, mainGray) font = LoadFont("arial", fontSize, False, False, False) SetFont font size = 4 x = screenWidth / 2 If Not threeD Color 0, 0, 0 size = 2 EndIf For xOff = -size To size For yOff = -size To size If threeD gray = paletteMax / 2 - (Abs(xOff) + yOff) * 10 safeColor gray + xOff * 15, gray - yOff * 10, gray - (xOff + Abs(yOff)) * 10 EndIf Text x + xOff, y + yOff, t$, True, True Next Next For xOff = size To 0 Step -1 For yOff = size To 0 Step -1 If threeD gray = paletteMax / 2 - (Abs(xOff) + yOff) * 10 safeColor gray + xOff * 15, gray - yOff * 10, gray - (xOff + Abs(yOff)) * 10 EndIf Text x + xOff, y + yOff, t$, True, True Next Next Color mainGray, mainGray, mainGray Text x, y, t$, True, True FreeFont font End Function Function safeColor(red, green, blue) Color intoLimits(red, 0, paletteMax), intoLimits(green, 0, paletteMax), intoLimits(blue, 0, paletteMax) End Function Function intoLimits(n, min, max) If n < min r = min ElseIf n > max r = max Else r = n EndIf Return r End Function