'=========================================================================== ' Subject: HOLIDAY SCREEN SAVER Date: 12-06-93 (00:00) ' Author: John T. Pope Code: QB, QBasic, PDS ' Origin: 74676.2453@Compuserve.com Packet: GRAPHICS.ABC '=========================================================================== ' Holiday Screen Saver ' by John T. Pape ' CompuServe 74676,2453 ' GEnie J.PAPE1 ' 12/06/93 ' holiday.bas ' requires MicroSoft QBasic DECLARE SUB treelights () 'subroutines DECLARE SUB makehouse () DECLARE SUB tree (tx%, ty%) DECLARE SUB lightsoff () DECLARE SUB lightson () DECLARE SUB delay () DECLARE SUB pause () DECLARE SUB playmusic () DECLARE SUB Initializeflakes () DIM SHARED FlakeX(200) AS INTEGER DIM SHARED FlakeY(200) AS INTEGER DIM FlakeEraseX(200) AS INTEGER DIM FlakeEraseY(200) AS INTEGER DIM FlakeColor(200) AS INTEGER DO 'configure PC speaker SCREEN 0 'text 80x25 CLS LOCATE 1, 26 PRINT "PC Speaker Sound Setup" LOCATE 10, 30 PRINT "1 - Sound On" LOCATE 12, 30 PRINT "2 - Sound Off" LOCATE 16, 23 PRINT "Type selection then [ENTER] "; 'get user input INPUT A$ IF A$ = "1" OR A$ = "2" THEN EXIT DO LOOP IF A$ = "1" THEN musicon% = 1 DO WHILE INKEY$ = "" 'main loop SCREEN 13 'mcga/vga 320x200x256 RANDOMIZE TIMER 'initialize Counter% = 0 ty% = 99 COLOR 15 'draw ground LINE (0, 99)-(319, 99) PAINT (1, 100), 15, 15 FOR tl% = 1 TO 3 tx% = 4 DO 'make 3 rows of trees CALL tree(tx%, ty%) tx% = tx% + (INT(RND * 3) + 5) LOOP WHILE tx% < 320 ty% = ty% + tl% NEXT tl% makehouse Initializeflakes DO FOR i% = 1 TO 200 FlakeColor(i%) = POINT(FlakeX(i%), FlakeY(i%)) PSET (FlakeX(i%), FlakeY(i%)), 15 NEXT i% IF INKEY$ <> "" THEN SYSTEM 'exit to system IF Counter% MOD 10 = 0 THEN lightson 'Christmas tree lights IF Counter% MOD 15 = 0 THEN lightsoff IF Counter% MOD 100 = 0 THEN Drift% = Drift% + INT(RND * 5) - 2 IF Drift% > 8 THEN Drift% = 8 IF Drift% < -8 THEN Drift% = -8 COLOR 15 sx% = INT(RND * 320) 'accumulating snow on trees sy% = INT(RND * 20) IF Counter% MOD 5 = 0 THEN PSET (sx%, sy% + 79) dx% = INT(RND * 79) + 41 'accumulating snow on drive dy% = INT(RND * 65) + 135 PSET (dx%, dy%) rx% = INT(RND * 89) 'accumulating snow on roof ry% = INT(RND * 11) IF Counter% MOD 3 = 0 THEN PSET (rx% + 116, ry% + 109) 'accumulating snow on steps IF Counter% MOD 24 = 0 THEN PSET ((INT(RND * 17) + 152), 142 + INT(RND * 6)) 'accumulating snow on sidewalk IF Counter% MOD 24 = 0 THEN PSET ((INT(RND * 68) + 119), 148 + INT(RND * 3)) FOR i% = 1 TO 200 FlakeEraseX(i%) = FlakeX(i%) FlakeEraseY(i%) = FlakeY(i%) NEXT i% FOR i% = 1 TO 200 FlakeY(i%) = FlakeY(i%) + 2 FlakeX(i%) = FlakeX(i%) + Drift% IF FlakeY(i%) > 199 THEN FlakeY(i%) = FlakeY(i%) - 200 IF FlakeX(i%) > 319 THEN FlakeX(i%) = FlakeX(i%) - 320 IF FlakeX(i%) < 0 THEN FlakeX(i%) = 320 + FlakeX(i%) NEXT i% FOR i% = 1 TO 200 PSET (FlakeEraseX(i%), FlakeEraseY(i%)), FlakeColor(i%) NEXT i% Counter% = Counter% + 1 'counter increment IF Counter% = 10000 THEN EXIT DO 'enough snow LOOP pause COLOR 0 LINE (130, 125)-(145, 135), , BF 'lights out in picture window pause LINE (170, 125)-(180, 135), , BF 'lights out small window 1 pause LINE (185, 125)-(195, 135), , BF 'lights out small window 2 pause FOR f% = 16 TO 31 'fade in moon COLOR f% CIRCLE (159, 29), 30 PAINT (160, 50), f%, f% delay NEXT f% LOCATE 9, 12 'text message COLOR 43 PRINT "Season's Greetings" IF musicon% THEN playmusic 'play music or not sx1% = 122 'chimney smoke sx2% = 124 sy% = 104 FOR f% = 103 TO 0 STEP -1 COLOR 24 IF POINT(sx1%, f%) = 43 THEN COLOR 43 PSET (sx1%, f%) COLOR 24 IF POINT(sx2%, f%) = 43 THEN COLOR 43 PSET (sx2%, f%) sx1% = sx1% + INT(RND * 3) - 1 sx2% = sx2% + INT(RND * 3) - 1 delay NEXT f% FOR f% = 1 TO 5 'long pause pause NEXT f% CLS LOOP 'restart SYSTEM 'exit to system SUB delay FOR increment% = 1 TO 5000 NEXT increment% END SUB SUB Initializeflakes FOR i% = 1 TO 200 DO Badflake% = 0 FlakeX(i%) = INT(RND * 319) + 1 FlakeY(i%) = INT(RND * 199) + 1 FOR j% = 1 TO i% - 1 'IF FlakeX(i%) = FlakeX(j%) AND FlakeY(i%) = FlakeY(j%) THEN Badflake% = 1 IF FlakeX(i%) = FlakeX(j%) THEN Badflake% = 1 NEXT j% IF NOT Badflake% = 1 THEN EXIT DO LOOP NEXT i% END SUB SUB lightsoff COLOR 119 PSET (134, 134) PSET (138, 134) PSET (141, 134) PSET (136, 132) PSET (140, 132) PSET (138, 129) END SUB SUB lightson COLOR 10 'tree lights on PSET (134, 134) COLOR 11 PSET (138, 134) COLOR 12 PSET (141, 134) COLOR 13 PSET (136, 132) COLOR 14 PSET (140, 132) COLOR 15 PSET (138, 129) END SUB SUB makehouse COLOR 0 LINE (120, 120)-(200, 150), , B 'draw house PAINT (160, 130), 4, 0 COLOR 0 'draw roof LINE (115, 110)-(205, 120), , B PAINT (130, 115), 21, 0 COLOR 0 'draw chimney LINE (120, 105)-(125, 110), , B PAINT (122, 108), 4, 0 LINE (130, 125)-(145, 135), , B 'picture window LINE (170, 125)-(180, 135), , B 'small window 1 LINE (185, 125)-(195, 135), , B 'small window 2 LINE (155, 125)-(165, 140), , B 'front door LINE (125, 125)-(128, 135), , B 'left shutter frame LINE (147, 125)-(150, 135), , B 'right shutter frame PAINT (175, 130), 92, 0 'light in windows PAINT (190, 130), 92, 0 PAINT (135, 130), 92, 0 PAINT (126, 130), 23, 0 'shutter fills PAINT (148, 130), 23, 0 LINE (175, 125)-(175, 135) 'window trim LINE (170, 130)-(180, 130) LINE (190, 125)-(190, 135) LINE (185, 130)-(195, 130) LINE (175, 125)-(170, 130) LINE (175, 125)-(180, 130) LINE (190, 125)-(185, 130) LINE (190, 125)-(195, 130) PAINT (160, 130), 23, 0 'front door fill PAINT (171, 126), 54, 0 'bedroom curtains PAINT (178, 126), 54, 0 PAINT (186, 126), 60, 0 PAINT (193, 126), 60, 0 COLOR 0 'porch lights PSET (153, 125) PSET (167, 125) COLOR 14 PSET (153, 126) PSET (167, 126) COLOR 15 'ground in front of house CIRCLE (160, 157), 71, 15, , , .2 PAINT (160, 145), 15, 15 COLOR 4 LINE (155, 141)-(165, 141) 'steps LINE (154, 143)-(166, 143) LINE (153, 145)-(167, 145) LINE (152, 147)-(168, 147) COLOR 113 LINE (154, 142)-(166, 142) LINE (153, 144)-(167, 144) LINE (152, 146)-(168, 146) CIRCLE (160, 130), 2, 2 'wreath COLOR 119 'Christmas Tree FOR f% = 134 TO 141 PSET (f%, 134) NEXT f% FOR f% = 134 TO 141 PSET (f%, 133) NEXT f% FOR f% = 135 TO 140 PSET (f%, 132) NEXT f% FOR f% = 135 TO 140 PSET (f%, 131) NEXT f% FOR f% = 136 TO 139 PSET (f%, 130) NEXT f% FOR f% = 136 TO 139 PSET (f%, 129) NEXT f% PSET (137, 128) PSET (138, 128) PSET (137, 127) PSET (138, 127) COLOR 0 'driveway LINE (120, 140)-(105, 140) LINE (120, 135)-(90, 135) LINE (105, 140)-(90, 199) LINE (90, 135)-(40, 199) PAINT (60, 195), 7, 0 COLOR 15 LINE (119, 140)-(106, 140) COLOR 7 'sidewalk LINE (168, 148)-(100, 148) LINE (168, 149)-(100, 149) LINE (168, 150)-(102, 150) COLOR 0 LINE (151, 148)-(103, 148) LINE (169, 148)-(169, 150) END SUB SUB pause FOR f% = 1 TO 50 delay IF INKEY$ <> "" THEN SYSTEM NEXT f% END SUB SUB playmusic PLAY "MB ML L8 O2" 'Tis the season... PLAY "A. L16 G L8 G- E D E G- L16 D . ." PLAY "E G- G E L8 G- E L4 D D-D ." END SUB SUB setsound END SUB SUB tree (tx%, ty%) 'make pine trees tc% = INT(RND * 9) + 116 'select tree color DO tt% = INT(RND * 9) 'tree trunk color IF tt% = 0 OR tt% = 6 OR tt% = 8 THEN EXIT DO LOOP COLOR tc% 'draw tree LINE (tx%, ty% - 20)-(tx% - 7, ty% - 4) LINE (tx% - 7, ty% - 4)-(tx% + 7, ty% - 4) LINE (tx% + 7, ty% - 4)-(tx%, ty% - 19) PAINT (tx%, ty% - 18), tc%, tc% PAINT (tx% - 3, ty% - 8), tc%, tc% PAINT (tx% + 3, ty% - 8), tc%, tc% COLOR tt% LINE (tx%, ty%)-(tx%, ty% - 5) END SUB