|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: P T
Length: 42908 (0xa79c)
Types: TextFile
Names: »Patches01«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/Sun/Qix/Patches01«
*** OLD/Makefile Tue Jan 12 15:53:56 1988
--- Makefile Mon Mar 7 21:55:35 1988
***************
*** 6,19 ****
ICONS= joystick.lf joystick.rt joystick.up joystick.dn joystick.stop \
spark1.pr spark2.pr spark3.pr spark4.pr marker.cursor qix.icon \
mouse.rt.icon
CFLAGS= -O
LDFLAGS=
LIBES= -lsuntool -lsunwindow -lpixrect
! qix.x: ${OBJS}
@echo loading...
@cc ${LDFLAGS} ${OBJS} ${LIBES} -o qix
# qix with a recursive polygon file rather than iterative.
# If you use it you have to unlimit the stacksize in csh
# and check the code to make sure it's called right (it's old).
--- 6,37 ----
ICONS= joystick.lf joystick.rt joystick.up joystick.dn joystick.stop \
spark1.pr spark2.pr spark3.pr spark4.pr marker.cursor qix.icon \
mouse.rt.icon
+
+ # Change these to suit your installation
+
+ SCOREFILE=/usr/games/lib/qix.scores
+ BINDIR=/usr/people/argv/bin
+
CFLAGS= -O
LDFLAGS=
LIBES= -lsuntool -lsunwindow -lpixrect
! all: qix
!
! qix: ${OBJS}
@echo loading...
@cc ${LDFLAGS} ${OBJS} ${LIBES} -o qix
+ install: all
+ install -s -c -m 2711 -o games -g games qix ${BINDIR}
+ touch ${SCOREFILE}
+ chmod 660 ${SCOREFILE}
+ -chgrp games ${SCOREFILE}
+ -chown games ${SCOREFILE}
+
+ score.o:
+ cc $(CFLAGS) -DSCOREFILE=\"${SCOREFILE}\" -c score.c
+
# qix with a recursive polygon file rather than iterative.
# If you use it you have to unlimit the stacksize in csh
# and check the code to make sure it's called right (it's old).
***************
*** 25,27 ****
--- 43,86 ----
btoa > qix.tarmail
shar: ; shar Makefile qix.h ${CFILES} ${ICONS} > qix.shar
+
+ clean:
+ rm -f qix $(OBJS)
+
+ lint:
+ lint -hbx $(CPPFLAGS) $(CFILES) $(LIBES)
+
+ depend: $(CFILES)
+ makedep -i $(CPPFLAGS) $(CFILES)
+
+ # DO NOT EDIT BELOW THIS LINE -- or it will disappear when you "make depend"
+
+ main.o: ./qix.icon
+ main.o: main.c
+
+ joystick.o: ./joystick.dn
+ joystick.o: ./joystick.lf
+ joystick.o: ./joystick.rt
+ joystick.o: ./joystick.stop
+ joystick.o: ./joystick.up
+ joystick.o: ./marker.cursor
+ joystick.o: ./mouse.rt.icon
+ joystick.o: joystick.c
+
+ sparks.o: ./spark1.pr
+ sparks.o: ./spark2.pr
+ sparks.o: ./spark3.pr
+ sparks.o: ./spark4.pr
+ sparks.o: sparks.c
+
+ regions.o: regions.c
+
+ qmove.o: qmove.c
+
+ polyfill.o: polyfill.c
+
+ polygon_area.o: polygon_area.c
+
+ polyfill_rec.o: polyfill_rec.c
+
+ score.o: score.c
*** OLD/joystick.c Tue Jan 12 17:30:52 1988
--- joystick.c Mon Mar 7 21:40:32 1988
***************
*** 108,114 ****
if (isdigit(ID)) {
debug = ID - '0';
msg("Debugging level set to %d", debug);
! sleep(2);
remove_msgs();
return;
} else
--- 108,114 ----
if (isdigit(ID)) {
debug = ID - '0';
msg("Debugging level set to %d", debug);
! Sleep(2);
remove_msgs();
return;
} else
***************
*** 164,172 ****
moving = DOWN;
when 'k' : case 'K' : case KEY_RIGHT(8) :
moving = UP;
! when LOC_MOVE : break; /* let those thru! */
#ifdef DEBUG
! case '@' : no_qix_kill = !no_qix_kill; drawing = 0;
when '#' : clear_sparks();
when '+' : lives = min(lives+1, MAX_LIVES); update_score(); drawing = 0;
when '-' : lives = max(lives-1, 1); update_score(); drawing = 0;
--- 164,178 ----
moving = DOWN;
when 'k' : case 'K' : case KEY_RIGHT(8) :
moving = UP;
! when LOC_MOVE : ; /* let those thru! (break-- do nothing) */
! when 3 : /* CTRL(C) */
! drawing = 0;
! if (play_mode == REAL_PLAY) {
! lives = 0;
! change_life(DIE);
! }
#ifdef DEBUG
! when '@' : no_qix_kill = !no_qix_kill; drawing = 0;
when '#' : clear_sparks();
when '+' : lives = min(lives+1, MAX_LIVES); update_score(); drawing = 0;
when '-' : lives = max(lives-1, 1); update_score(); drawing = 0;
***************
*** 198,208 ****
if (!is_alive && lives > 0) {
/* user has died and is waiting to start again */
! sleep(2);
change_life(LIVE);
stop_timer(); /* change_life restarts it */
msg("Ready?");
! sleep(2);
remove_msgs(0);
start_timer();
return;
--- 204,214 ----
if (!is_alive && lives > 0) {
/* user has died and is waiting to start again */
! Sleep(2);
change_life(LIVE);
stop_timer(); /* change_life restarts it */
msg("Ready?");
! Sleep(2);
remove_msgs(0);
start_timer();
return;
***************
*** 281,287 ****
when SHOW_QIX :
remove_msgs(0);
msg("Your Enemies:");
! sleep(2);
time_left = 40;
when SHOW_SPARKS :
time_left = 90;
--- 287,293 ----
when SHOW_QIX :
remove_msgs(0);
msg("Your Enemies:");
! Sleep(2);
time_left = 40;
when SHOW_SPARKS :
time_left = 90;
***************
*** 298,304 ****
change_life(LIVE);
stop_timer();
msg("Enclose more than\n75%%\nof the play area for extra bonus.");
! sleep(2);
remove_msgs(0);
level = -2;
drawing = fast = 1;
--- 304,310 ----
change_life(LIVE);
stop_timer();
msg("Enclose more than\n75%%\nof the play area for extra bonus.");
! Sleep(2);
remove_msgs(0);
level = -2;
drawing = fast = 1;
***************
*** 308,322 ****
when SHOW_QIX :
move_qix();
if (time_left == 1) {
! pw_text(draw_win, 200,200,PIX_SRC,big_font, "The qix.");
! sleep(2);
}
when SHOW_SPARKS :
move_sparks();
if (time_left == 1) {
! pw_text(draw_win, 15, 110, PIX_SRC, big_font, "Sparx.");
! pw_text(draw_win,625, 110, PIX_SRC, big_font, "Sparx.");
! sleep(2);
}
when SHOW_FUSE :
/* after the pw_text, this moves into spiral death trap */
--- 314,335 ----
when SHOW_QIX :
move_qix();
if (time_left == 1) {
! pw_putattributes(draw_win, &text_mask);
! pw_text(draw_win, 200,200,PIX_SRC|PIX_COLOR(TEXT_COLOR),
! big_font, "The qix.");
! Sleep(2);
}
when SHOW_SPARKS :
move_sparks();
if (time_left == 1) {
! pw_putattributes(draw_win, &text_mask);
! pw_text(draw_win, 15, 110,
! PIX_SRC|PIX_COLOR(TEXT_COLOR),
! big_font, "Sparx.");
! pw_text(draw_win,625, 110,
! PIX_SRC|PIX_COLOR(TEXT_COLOR),
! big_font, "Sparx.");
! Sleep(2);
}
when SHOW_FUSE :
/* after the pw_text, this moves into spiral death trap */
***************
*** 323,334 ****
switch (time_left) {
when 230 :
drawing = 0;
pw_text(draw_win,
convert_x(pen_x - 7), convert_y(pen_y + 7),
! PIX_SRC, big_font, "The fuse.");
when 80 :
pw_text(draw_win, 265, 445,
! PIX_SRC, big_font, "The Spiral Death Trap.");
case 200 : case 240 : case 40 : case 20 :
moving = LEFT, drawing = 1;
when 110 : case 55 : case 30 : moving = RIGHT;
--- 336,351 ----
switch (time_left) {
when 230 :
drawing = 0;
+ pw_putattributes(draw_win, &text_mask);
pw_text(draw_win,
convert_x(pen_x - 7), convert_y(pen_y + 7),
! PIX_SRC|PIX_COLOR(TEXT_COLOR),
! big_font, "The fuse.");
when 80 :
+ pw_putattributes(draw_win, &text_mask);
pw_text(draw_win, 265, 445,
! PIX_SRC|PIX_COLOR(TEXT_COLOR),
! big_font, "The Spiral Death Trap.");
case 200 : case 240 : case 40 : case 20 :
moving = LEFT, drawing = 1;
when 110 : case 55 : case 30 : moving = RIGHT;
***************
*** 342,348 ****
goto movit;
} else if (region) {
move_fuse(fuse = NULL);
! rm_cur_line(PIX_SRC);
}
when SHOW_POINTS : {
char buf[5];
--- 359,365 ----
goto movit;
} else if (region) {
move_fuse(fuse = NULL);
! rm_cur_line(PIX_SRC|PIX_COLOR(BORDER_COLOR));
}
when SHOW_POINTS : {
char buf[5];
***************
*** 358,371 ****
when 250 : case 130 : moving = RIGHT;
when 230 : case 90 : moving = DOWN;
when 210 : drawing = 0, moving = RIGHT;
pw_text(draw_win,
convert_x(pen_x - 12), convert_y(pen_y - 25),
! PIX_SRC, big_font, sprintf(buf, "%d", score));
when 49 : /* make sure region is closed */
msg("Use RIGHT mouse button to STOP movement.");
pw_text(draw_win,
convert_x(pen_x - 12), convert_y(pen_y - 25),
! PIX_SRC, big_font, sprintf(buf, "%d", score));
when 15 : drawing = 0, moving = RIGHT;
}
goto movit; /* avoid moving qix and sparks */
--- 375,392 ----
when 250 : case 130 : moving = RIGHT;
when 230 : case 90 : moving = DOWN;
when 210 : drawing = 0, moving = RIGHT;
+ pw_putattributes(draw_win, &text_mask);
pw_text(draw_win,
convert_x(pen_x - 12), convert_y(pen_y - 25),
! PIX_SRC|PIX_COLOR(TEXT_COLOR),
! big_font, sprintf(buf, "%d", score));
when 49 : /* make sure region is closed */
msg("Use RIGHT mouse button to STOP movement.");
+ pw_putattributes(draw_win, &text_mask);
pw_text(draw_win,
convert_x(pen_x - 12), convert_y(pen_y - 25),
! PIX_SRC|PIX_COLOR(TEXT_COLOR),
! big_font, sprintf(buf, "%d", score));
when 15 : drawing = 0, moving = RIGHT;
}
goto movit; /* avoid moving qix and sparks */
***************
*** 493,500 ****
board[pen_x][pen_y] |= CL_LN_DN;
board[x][y] |= CL_LN_UP;
}
draw(convert_x(x), convert_y(y),
! convert_x(pen_x), convert_y(pen_y), PIX_SRC);
if (!region) {
saved_edge = old_value;
add_to_line(pen_x, pen_y);
--- 514,523 ----
board[pen_x][pen_y] |= CL_LN_DN;
board[x][y] |= CL_LN_UP;
}
+ pw_putattributes(draw_win, &border_mask);
draw(convert_x(x), convert_y(y),
! convert_x(pen_x), convert_y(pen_y),
! PIX_SRC|PIX_COLOR(BORDER_COLOR));
if (!region) {
saved_edge = old_value;
add_to_line(pen_x, pen_y);
***************
*** 518,524 ****
}
} else
level++;
! sleep(3);
clear_board(); /* removes msgs also */
change_life(LIVE);
stop_timer();
--- 541,547 ----
}
} else
level++;
! Sleep(3);
clear_board(); /* removes msgs also */
change_life(LIVE);
stop_timer();
***************
*** 526,532 ****
level++;
if (level == 0) {
msg("Split the 2 qix to advance score multiplier.");
! sleep(2);
remove_msgs(0);
}
start_timer();
--- 549,555 ----
level++;
if (level == 0) {
msg("Split the 2 qix to advance score multiplier.");
! Sleep(2);
remove_msgs(0);
}
start_timer();
***************
*** 551,561 ****
moving == UP? &joystick_up :
moving == DOWN? &joystick_down :
moving == STOP? &joystick_stop : &ready_icon;
pw_rop(joystick_win,
! BOARD_WIDTH_IN_PIXELS/2-32, 2, 64, 64, PIX_SRC, image, 0,0);
! pw_rop(joystick_win, 100,32, 16,23, PIX_SRC,
(drawing && fast)? &ms_fast_on : &ms_fast_off, 0, 0);
! pw_rop(joystick_win, 150,32, 16,23, PIX_SRC,
(drawing && !fast)? &ms_slow_on : &ms_slow_off, 0, 0);
}
--- 574,586 ----
moving == UP? &joystick_up :
moving == DOWN? &joystick_down :
moving == STOP? &joystick_stop : &ready_icon;
+ pw_putattributes(joystick_win, &border_mask);
pw_rop(joystick_win,
! BOARD_WIDTH_IN_PIXELS/2-32, 2, 64, 64, PIX_SRC|PIX_COLOR(BORDER_COLOR),
! image, 0,0);
! pw_rop(joystick_win, 100,32, 16,23, PIX_SRC|PIX_COLOR(BORDER_COLOR),
(drawing && fast)? &ms_fast_on : &ms_fast_off, 0, 0);
! pw_rop(joystick_win, 150,32, 16,23, PIX_SRC|PIX_COLOR(BORDER_COLOR),
(drawing && !fast)? &ms_slow_on : &ms_slow_off, 0, 0);
}
*** OLD/main.c Tue Jan 12 17:09:06 1988
--- main.c Mon Mar 7 21:45:09 1988
***************
*** 3,12 ****
* Appearance ONLY shamelessly stolen from the real video game wonderfully
* and admirably written by individual(s) unknown at Taito Corp (I think).
*
! * Copyright 1987 by Dan Heller (island!argv@sun.com or argv@spam.istc.sri.com)
*
* Various polygon filling routines written by
! * -- Dan "Sky" Shultz (island!sky@sun.com) and
* -- Don Hatch (splat%ucscb@ucscc.ucsc.edu [fall, 1987])
* additional help (general debugging, recursive polyfill)
*
--- 3,14 ----
* Appearance ONLY shamelessly stolen from the real video game wonderfully
* and admirably written by individual(s) unknown at Taito Corp (I think).
*
! * Copyright 1987 by Dan Heller
! * island!argv@sun.com
! * dheller@dheller@ucbcory.berkeley.edu
*
* Various polygon filling routines written by
! * -- Dan "Sky" Shultz
* -- Don Hatch (splat%ucscb@ucscc.ucsc.edu [fall, 1987])
* additional help (general debugging, recursive polyfill)
*
***************
*** 33,38 ****
--- 35,46 ----
int (*old_repaint_func)();
+ int qix_mask = 0x7;
+ int text_mask = TEXT_COLOR;
+ int fast_draw_mask = FAST_DRAW_COLOR;
+ int slow_draw_mask = SLOW_DRAW_COLOR;
+ int border_mask = BORDER_COLOR;
+ int all_mask = 0xff;
redraw(args)
{
***************
*** 51,57 ****
(void) signal(SIGSEGV, catch);
(void) signal(SIGXCPU, catch);
- #ifdef DEBUG
/*
* specify debug levels "-d level"
* a level of 2 prints polygon fill info. 4 disables spark-generation
--- 59,64 ----
***************
*** 58,64 ****
* but doesn't kill current sparks. debug level 1 does prints things...
*/
while (*++newargv)
! if (!strcmp(*newargv, "-q"))
no_qix_kill = 1;
else if (!strcmp(*newargv, "-d"))
debug = (*++newargv) ? atoi(*newargv) : 1;
--- 65,79 ----
* but doesn't kill current sparks. debug level 1 does prints things...
*/
while (*++newargv)
! if (!strcmp(*newargv, "-s"))
! if (!*++newargv)
! puts("usage: qix [-s timeout] (in milliseconds)"), exit(1);
! else {
! if ((interval = atoi(*newargv)) < 15000 || interval > 60000)
! puts("delay must be between 15000 and 60000"), exit(1);
! }
! #ifdef DEBUG
! else if (!strcmp(*newargv, "-q"))
no_qix_kill = 1;
else if (!strcmp(*newargv, "-d"))
debug = (*++newargv) ? atoi(*newargv) : 1;
***************
*** 79,84 ****
--- 94,101 ----
0);
draw_win = canvas_pixwin(Draw);
+ if (interval == 0)
+ interval = (draw_win->pw_pixrect->pr_depth == 8)? 35000 : 50000;
window_set(Draw,
CANVAS_FAST_MONO, TRUE,
WIN_CONSUME_PICK_EVENTS,
***************
*** 99,104 ****
--- 116,165 ----
0);
joystick_win = canvas_pixwin(Joystick);
+ /*
+ * set color map segment name and load color map
+ */
+ {
+ static char cmsname[CMS_NAMESIZE];
+ static char r[QIX_CMS_SIZE],g[QIX_CMS_SIZE],b[QIX_CMS_SIZE];
+
+ (void) strcpy(cmsname, QIX_CMS_NAME);
+ pw_setcmsname(draw_win, cmsname);
+ pw_setcmsname(joystick_win, cmsname);
+
+ /* blueish */
+ r[FAST_DRAW_COLOR] = 40;
+ g[FAST_DRAW_COLOR] = 170;
+ b[FAST_DRAW_COLOR] = 213;
+
+ /* brownish */
+ r[SLOW_DRAW_COLOR] = 213;
+ g[SLOW_DRAW_COLOR] = 170;
+ b[SLOW_DRAW_COLOR] = 0;
+
+ /* dark something */
+ r[TEXT_COLOR] = 0;
+ g[TEXT_COLOR] = 80;
+ b[TEXT_COLOR] = 190;
+
+ /* red sparks when not aggressive */
+ r[SPARKS_COLOR] = 255;
+ g[SPARKS_COLOR] = 0;
+ b[SPARKS_COLOR] = 0;
+
+ /* blue sparks when aggressive */
+ r[AGGR_SPARK_COLOR] = 0;
+ g[AGGR_SPARK_COLOR] = 0;
+ b[AGGR_SPARK_COLOR] = 255;
+
+ cms_rainbowsetup(&r[QIX_COLOR_BASE],
+ &g[QIX_COLOR_BASE],
+ &b[QIX_COLOR_BASE]);
+
+ pw_putcolormap(draw_win, 0, QIX_CMS_SIZE, r, g, b);
+ pw_putcolormap(joystick_win, 0, QIX_CMS_SIZE, r, g, b);
+ }
+
window_fit(frame);
if (!(small_font = pf_open("/usr/people/argv/computer.14")) &&
***************
*** 120,126 ****
pw_text(joystick_win, 92, 24, PIX_SRC, small_font, "Fast Slow");
play_mode = SHOW_SCORES;
update_score();
! score_board(TRUE, FALSE);
time_left = 100; /* timeout before next demo mode switch */
(void) signal(SIGALRM, move_pen);
old_repaint_func = (int(*)())window_get(frame, CANVAS_REPAINT_PROC);
--- 181,187 ----
pw_text(joystick_win, 92, 24, PIX_SRC, small_font, "Fast Slow");
play_mode = SHOW_SCORES;
update_score();
! (void) score_board(TRUE, FALSE);
time_left = 100; /* timeout before next demo mode switch */
(void) signal(SIGALRM, move_pen);
old_repaint_func = (int(*)())window_get(frame, CANVAS_REPAINT_PROC);
***************
*** 141,152 ****
pen_x = (BOARD_WIDTH-1)/2, pen_y = BOARD_HEIGHT-1;
remove_msgs(1);
/* give left->right sweeping effect like the real game */
for (x = 0; x < BOARD_WIDTH_IN_PIXELS; x++)
draw(x, 0, x, BOARD_HEIGHT_IN_PIXELS-1, PIX_CLR);
box(convert_x(0), convert_y(0),
! convert_x(BOARD_WIDTH-1), convert_y(BOARD_HEIGHT-1), PIX_SRC);
/* clear the interior of the board */
for (x = 1; x < BOARD_WIDTH-1; x++)
--- 202,217 ----
pen_x = (BOARD_WIDTH-1)/2, pen_y = BOARD_HEIGHT-1;
remove_msgs(1);
+ pw_putattributes(draw_win, &all_mask);
+
/* give left->right sweeping effect like the real game */
for (x = 0; x < BOARD_WIDTH_IN_PIXELS; x++)
draw(x, 0, x, BOARD_HEIGHT_IN_PIXELS-1, PIX_CLR);
+ pw_putattributes(draw_win, &border_mask);
box(convert_x(0), convert_y(0),
! convert_x(BOARD_WIDTH-1), convert_y(BOARD_HEIGHT-1),
! PIX_SRC|PIX_COLOR(BORDER_COLOR));
/* clear the interior of the board */
for (x = 1; x < BOARD_WIDTH-1; x++)
***************
*** 194,200 ****
lives = 1;
else
lives = MAX_LIVES;
! clear_board(); /* resets pen_x, pen_y */
level = -2, score = 0;
} else {
extern int qix1_x0[], qix1_x1[], qix1_y0[], qix1_y1[];
--- 259,265 ----
lives = 1;
else
lives = MAX_LIVES;
! clear_board(); /* resets pen_x, pen_y (changes plane mask) */
level = -2, score = 0;
} else {
extern int qix1_x0[], qix1_x1[], qix1_y0[], qix1_y1[];
***************
*** 217,248 ****
drawing = FALSE;
if (level > 0) {
msg("All scores now\n%d times\ntheir original value.", level+1);
! sleep(3);
remove_msgs(0);
}
place_pen(); /* make pen appear */
}
for (x = 0; x < 2; x++)
for (n = m; n >= 40 && n <= 300; n -= 5 * live_or_die)
box(pen_coord_x(pen_x)-n/2, pen_coord_y(pen_y)-n/2,
! pen_coord_x(pen_x)+n/2, pen_coord_y(pen_y)+n/2, XOR);
if (live_or_die == DIE) {
is_alive = FALSE;
if (--lives <= 0) {
reset_joystick_win(TRUE);
msg("Game Over.");
! sleep(2);
/* if he got on the scoreboard, let him put his initials up */
if (play_mode == REAL_PLAY)
! score_board(FALSE, FALSE);
if (play_mode == SHOW_SPIRAL)
time_left = 50; /* demo mode comes after spiral death trap */
else {
- score_board(TRUE, FALSE);
play_mode = SHOW_SCORES;
! time_left = 100; /* show scores after demo mode or real play */
}
moving = NO_MOVE;
} else {
--- 282,318 ----
drawing = FALSE;
if (level > 0) {
msg("All scores now\n%d times\ntheir original value.", level+1);
! Sleep(3);
remove_msgs(0);
}
place_pen(); /* make pen appear */
}
+ pw_putattributes(draw_win, &border_mask);
for (x = 0; x < 2; x++)
for (n = m; n >= 40 && n <= 300; n -= 5 * live_or_die)
box(pen_coord_x(pen_x)-n/2, pen_coord_y(pen_y)-n/2,
! pen_coord_x(pen_x)+n/2, pen_coord_y(pen_y)+n/2,
! XOR | PIX_COLOR(BORDER_COLOR));
if (live_or_die == DIE) {
is_alive = FALSE;
if (--lives <= 0) {
+ int do_scores = TRUE;
reset_joystick_win(TRUE);
msg("Game Over.");
! Sleep(2);
/* if he got on the scoreboard, let him put his initials up */
if (play_mode == REAL_PLAY)
! do_scores = (score_board(FALSE, FALSE) == 0);
if (play_mode == SHOW_SPIRAL)
time_left = 50; /* demo mode comes after spiral death trap */
else {
play_mode = SHOW_SCORES;
! if (do_scores)
! (void) score_board(TRUE, FALSE), time_left = 300;
! else
! time_left = 100;
}
moving = NO_MOVE;
} else {
***************
*** 263,284 ****
int x;
sprintf(buf, "Score: %6d", score);
! pw_text(joystick_win, 500, 22, PIX_SRC, big_font, buf);
! pw_text(joystick_win, 500, 22, PIX_SRC|PIX_DST, big_font, buf);
if (play_mode != REAL_PLAY) {
! pw_text(draw_win, 105, 12, PIX_SRC, small_font,
"Click RIGHT mouse button or use <spacebar> to start new game.");
return;
}
! pw_text(joystick_win, 500, 45, PIX_SRC, big_font, "Lives: ");
for (x = 0; x < MAX_LIVES; x++)
! pw_rop(joystick_win, 575+(x*20), 32, 16,16, (x < lives-1)?
! PIX_SRC:PIX_CLR, &pen_image, 0, 0);
sprintf(buf, "Filled: %d%%",(int)((double)area_closed/TOTAL_AREA*100));
! pw_text(draw_win, 280, 12, PIX_SRC, small_font, buf);
! pw_text(draw_win, 281, 12, PIX_SRC|PIX_DST, small_font, buf);
}
Pixrect *save[15]; /* area under text to be redisplayed upon removal of text */
--- 333,362 ----
int x;
sprintf(buf, "Score: %6d", score);
! pw_putattributes(joystick_win, &text_mask);
! pw_text(joystick_win, 500, 22, PIX_SRC|PIX_COLOR(TEXT_COLOR),
! big_font, buf);
! pw_text(joystick_win, 500, 22, PIX_SRC|PIX_DST|PIX_COLOR(TEXT_COLOR),
! big_font, buf);
if (play_mode != REAL_PLAY) {
! pw_text(draw_win, 105, 12, PIX_SRC|PIX_COLOR(TEXT_COLOR), small_font,
"Click RIGHT mouse button or use <spacebar> to start new game.");
return;
}
! pw_text(joystick_win, 500, 45, PIX_SRC|PIX_COLOR(TEXT_COLOR),
! big_font, "Lives: ");
! pw_putattributes(joystick_win, &border_mask);
for (x = 0; x < MAX_LIVES; x++)
! pw_rop(joystick_win, 575+(x*20), 32, 16,16, ((x < lives-1)?
! PIX_SRC:PIX_CLR)|PIX_COLOR(BORDER_COLOR), &pen_image, 0, 0);
!
sprintf(buf, "Filled: %d%%",(int)((double)area_closed/TOTAL_AREA*100));
! pw_putattributes(draw_win, &text_mask);
! pw_text(draw_win, 280, 12, PIX_SRC|PIX_COLOR(TEXT_COLOR), small_font, buf);
! pw_text(draw_win, 281, 12, PIX_SRC|PIX_DST|PIX_COLOR(TEXT_COLOR),
! small_font, buf);
}
Pixrect *save[15]; /* area under text to be redisplayed upon removal of text */
***************
*** 286,291 ****
--- 364,370 ----
static int msgs; /* the number of text lines displayed on the board */
/* print a message somewhere at the top of the playing board for two seconds */
+ /*VARARGS1*/
msg(fmt, args)
char *fmt;
{
***************
*** 298,303 ****
--- 377,383 ----
#ifdef DEBUG
puts(buf);
#endif DEBUG
+ pw_putattributes(draw_win, &text_mask);
do {
if (p2 = index(p, '\n'))
*p2 = 0;
***************
*** 313,321 ****
draw_win->pw_prretained, x_pos[msgs], y_pos[msgs]);
pw_text(draw_win, x_pos[msgs], y_pos[msgs]+l_height(big_font)-5,
! PIX_SRC, big_font, p);
pw_text(draw_win, x_pos[msgs]+1, y_pos[msgs]+l_height(big_font)-5,
! PIX_SRC|PIX_DST, big_font, p);
} while (++msgs < 15 && p2 && *(p = p2+1));
}
--- 393,401 ----
draw_win->pw_prretained, x_pos[msgs], y_pos[msgs]);
pw_text(draw_win, x_pos[msgs], y_pos[msgs]+l_height(big_font)-5,
! PIX_SRC | PIX_COLOR(TEXT_COLOR), big_font, p);
pw_text(draw_win, x_pos[msgs]+1, y_pos[msgs]+l_height(big_font)-5,
! PIX_SRC|PIX_DST | PIX_COLOR(TEXT_COLOR), big_font, p);
} while (++msgs < 15 && p2 && *(p = p2+1));
}
***************
*** 322,331 ****
/* remove all messages from the board and put back the images underneith */
remove_msgs(clearing)
{
while (msgs--) {
if (!clearing)
pw_rop(draw_win, x_pos[msgs], y_pos[msgs], x_save[msgs], y_save,
! PIX_SRC, save[msgs], 0, 0);
pr_destroy(save[msgs]);
}
msgs = 0;
--- 402,412 ----
/* remove all messages from the board and put back the images underneith */
remove_msgs(clearing)
{
+ pw_putattributes(draw_win, &text_mask);
while (msgs--) {
if (!clearing)
pw_rop(draw_win, x_pos[msgs], y_pos[msgs], x_save[msgs], y_save,
! PIX_SRC | PIX_COLOR(TEXT_COLOR), save[msgs], 0, 0);
pr_destroy(save[msgs]);
}
msgs = 0;
***************
*** 336,342 ****
stop_timer();
if (sig == SIGXCPU) {
msg("CPU timelimit exceeded. Go home and eat dinner.");
! sleep(2);
remove_msgs(0);
return;
}
--- 417,423 ----
stop_timer();
if (sig == SIGXCPU) {
msg("CPU timelimit exceeded. Go home and eat dinner.");
! Sleep(2);
remove_msgs(0);
return;
}
***************
*** 346,349 ****
--- 427,448 ----
else
fprintf(stderr, "Bus Error\n");
abort();
+ }
+
+ void
+ flush_events()
+ {
+ struct timeval dummy;
+ Event event;
+ int readfd = 1 << (int)window_get(Draw, WIN_FD);
+
+ timerclear(&dummy);
+ while (select(readfd+1, &readfd, 0, 0, &dummy) > 0)
+ window_read_event(Draw, &event);
+ }
+
+ Sleep(n)
+ {
+ sleep(n);
+ flush_events();
}
*** OLD/qix.h Wed Dec 23 17:50:58 1987
--- qix.h Mon Mar 7 21:28:36 1988
***************
*** 19,28 ****
#include <sys/time.h>
#include <ctype.h>
#define when break;case
#define otherwise break;default
#define rrand random
- #define SCOREFILE "qix.scores"
Frame frame;
Canvas Draw, Joystick;
--- 19,48 ----
#include <sys/time.h>
#include <ctype.h>
+ #include <sunwindow/cms_rainbow.h>
+
+ /* qix uses 0..7 */
+ #define QIX_COLOR_BASE 0
+ #define TEXT_COLOR 8
+ #define SLOW_DRAW_COLOR 16
+ #define FAST_DRAW_COLOR 32
+ #define SPARKS_COLOR RED
+ #define AGGR_SPARK_COLOR BLUE
+ #define BORDER_COLOR 128
+
+ #define QIX_CMS_SIZE 256
+ #define QIX_CMS_NAME "QIX"
+
+ extern int text_mask;
+ extern int qix_mask;
+ extern int fast_draw_mask;
+ extern int slow_draw_mask;
+ extern int border_mask;
+ extern int all_mask;
+
#define when break;case
#define otherwise break;default
#define rrand random
Frame frame;
Canvas Draw, Joystick;
***************
*** 44,51 ****
struct itimerval timeout;
#define start_timer() \
! timeout.it_value.tv_usec = 50000, setitimer(ITIMER_REAL, &timeout, NULL);
#define stop_timer() \
timerclear(&timeout.it_value), setitimer(ITIMER_REAL, &timeout, NULL);
--- 64,72 ----
struct itimerval timeout;
+ long interval; /* 50000 for monochrome or 35000 for color displays */
#define start_timer() \
! timeout.it_value.tv_usec = interval, setitimer(ITIMER_REAL, &timeout, NULL);
#define stop_timer() \
timerclear(&timeout.it_value), setitimer(ITIMER_REAL, &timeout, NULL);
***************
*** 105,113 ****
extern Pixrect pen_image;
/* place_pen() macro XOR's the pen at its current coordinates */
! #define place_pen() pw_rop(draw_win, \
! pen_coord_x(pen_x), pen_coord_y(pen_y), \
! 16, 16, XOR, &pen_image, 0, 0)
#define XOR (PIX_SRC^PIX_DST)
#define draw(x1,y1,x2,y2,OP) pw_vector(draw_win, x1,y1,x2,y2,(OP),1)
--- 126,136 ----
extern Pixrect pen_image;
/* place_pen() macro XOR's the pen at its current coordinates */
! #define place_pen() \
! pw_putattributes(draw_win, &qix_mask), \
! pw_rop(draw_win, \
! pen_coord_x(pen_x), pen_coord_y(pen_y), \
! 16, 16, XOR|PIX_COLOR(VIOLET), &pen_image, 0, 0)
#define XOR (PIX_SRC^PIX_DST)
#define draw(x1,y1,x2,y2,OP) pw_vector(draw_win, x1,y1,x2,y2,(OP),1)
*** OLD/qmove.c Mon Jan 11 14:53:04 1988
--- qmove.c Mon Mar 7 21:41:38 1988
***************
*** 38,44 ****
static index = 0, count;
int i, j;
! if (level < 0 && count++ & 1)
return 0;
if (qix1_x0[index] <= 0)
--- 38,44 ----
static index = 0, count;
int i, j;
! if (level < -1 && count++ & 1)
return 0;
if (qix1_x0[index] <= 0)
***************
*** 87,97 ****
i = (index + 1) % NLINES;
/* erase old line */
draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
! convert_x(qix1_x1[i]), convert_y(qix1_y1[i]), PIX_CLR);
if (level > -1)
draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
! convert_x(qix2_x1[i]), convert_y(qix2_y1[i]), PIX_CLR);
qix1_x0[i] = qix1_x0[index] + qix1_dx0;
qix1_y0[i] = qix1_y0[index] + qix1_dy0;
--- 87,102 ----
i = (index + 1) % NLINES;
/* erase old line */
+ pw_putattributes(draw_win, &qix_mask);
draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
! convert_x(qix1_x1[i]), convert_y(qix1_y1[i]),
! PIX_CLR|PIX_COLOR((index % CMS_RAINBOWSIZE) +
! QIX_COLOR_BASE));
if (level > -1)
draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
! convert_x(qix2_x1[i]), convert_y(qix2_y1[i]),
! PIX_CLR|PIX_COLOR((index % CMS_RAINBOWSIZE) +
! QIX_COLOR_BASE));
qix1_x0[i] = qix1_x0[index] + qix1_dx0;
qix1_y0[i] = qix1_y0[index] + qix1_dy0;
***************
*** 107,116 ****
index = i;
draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
! convert_x(qix1_x1[i]), convert_y(qix1_y1[i]), PIX_SRC);
if (level > -1)
draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
! convert_x(qix2_x1[i]), convert_y(qix2_y1[i]), PIX_SRC);
return j;
}
--- 112,125 ----
index = i;
draw(convert_x(qix1_x0[i]), convert_y(qix1_y0[i]),
! convert_x(qix1_x1[i]), convert_y(qix1_y1[i]),
! PIX_SRC|PIX_COLOR((index % CMS_RAINBOWSIZE) +
! QIX_COLOR_BASE));
if (level > -1)
draw(convert_x(qix2_x0[i]), convert_y(qix2_y0[i]),
! convert_x(qix2_x1[i]), convert_y(qix2_y1[i]),
! PIX_SRC|PIX_COLOR((index % CMS_RAINBOWSIZE) +
! QIX_COLOR_BASE));
return j;
}
***************
*** 125,134 ****
if (!(rrand() % 10)) {
register int r;
/* move at least one space, but not greater than "Speed" */
! *dx0 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1);
! *dy0 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1);
! *dx1 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1);
! *dy1 = (1 + (r = rrand())%(Speed-1)) * ((r&1) ? -1 : 1);
/* check that qix is moving towards player */
if (level > -2 && !(rrand() % (6 - level))) {
if (pen_x - x0 > 0 && *dx0 < 0)
--- 134,147 ----
if (!(rrand() % 10)) {
register int r;
/* move at least one space, but not greater than "Speed" */
! r = rrand();
! *dx0 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
! r = rrand();
! *dy0 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
! r = rrand();
! *dx1 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
! r = rrand();
! *dy1 = (1 + r%(Speed-1)) * ((r&1) ? -1 : 1);
/* check that qix is moving towards player */
if (level > -2 && !(rrand() % (6 - level))) {
if (pen_x - x0 > 0 && *dx0 < 0)
***************
*** 180,186 ****
if (!(++loop_count % 100)) {
#ifdef DEBUG
msg("bad news... loop count hit %d", loop_count);
! sleep(2);
remove_msgs(0);
#endif DEBUG
break;
--- 193,199 ----
if (!(++loop_count % 100)) {
#ifdef DEBUG
msg("bad news... loop count hit %d", loop_count);
! Sleep(2);
remove_msgs(0);
#endif DEBUG
break;
***************
*** 235,241 ****
return 0;
}
msg("The qix is trapped in a place it shouldn't have gotten to!");
! sleep(2);
remove_msgs(0);
return -1;
}
--- 248,254 ----
return 0;
}
msg("The qix is trapped in a place it shouldn't have gotten to!");
! Sleep(2);
remove_msgs(0);
return -1;
}
*** OLD/regions.c Mon Dec 21 22:15:46 1987
--- regions.c Mon Mar 7 21:41:47 1988
***************
*** 62,69 ****
return -1;
if (level > -1 && edge != n) {
msg("You split the two qix!");
! sleep(2);
! rm_cur_line(PIX_SRC); /* don't erase it, but free it up */
moving = STOP;
return 1;
}
--- 62,70 ----
return -1;
if (level > -1 && edge != n) {
msg("You split the two qix!");
! Sleep(2);
! /* don't erase it, but free it up */
! rm_cur_line(PIX_SRC|PIX_COLOR(BORDER_COLOR));
moving = STOP;
return 1;
}
***************
*** 108,114 ****
msg("can't fill region; over 10000 positions");
pen_x = region->x, pen_y = region->y;
msg("removing bad line ...(takes a while)");
! rm_cur_line(XOR); /* causes dotted line effect */
remove_msgs(0);
return -1;
}
--- 109,116 ----
msg("can't fill region; over 10000 positions");
pen_x = region->x, pen_y = region->y;
msg("removing bad line ...(takes a while)");
! /* causes dotted line effect */
! rm_cur_line(XOR|PIX_COLOR(BORDER_COLOR));
remove_msgs(0);
return -1;
}
***************
*** 258,265 ****
#endif
toggle_sparks();
! pw_polygon_2(draw_win, 0,0,1, npts, new_area, PIX_SRC | PIX_DST,
! fast? &fast_grey : &slow_grey,0,0);
toggle_sparks();
free(new_area);
--- 260,270 ----
#endif
toggle_sparks();
! pw_putattributes(draw_win, fast ? &fast_draw_mask: &slow_draw_mask);
! pw_polygon_2(draw_win, 0,0,1, npts, new_area,
! PIX_SRC | PIX_DST | PIX_COLOR(fast ? FAST_DRAW_COLOR: SLOW_DRAW_COLOR),
! draw_win->pw_pixrect->pr_depth == 8? NULL :
! fast? &fast_grey : &slow_grey, 0, 0);
toggle_sparks();
free(new_area);
***************
*** 278,284 ****
(moving == RIGHT)? "right" : "left",
(edge == UP)? "up" : (edge == DOWN)? "down" :
(edge == RIGHT)? "right" : "left");
! sleep(2);
remove_msgs(0);
}
#endif DEBUG
--- 283,289 ----
(moving == RIGHT)? "right" : "left",
(edge == UP)? "up" : (edge == DOWN)? "down" :
(edge == RIGHT)? "right" : "left");
! Sleep(2);
remove_msgs(0);
}
#endif DEBUG
***************
*** 285,290 ****
--- 290,296 ----
rm_cur_line(op)
{
+ pw_putattributes(draw_win, &border_mask);
if (region)
board[region->x][region->y] = saved_edge;
while (cur_coord)
*** OLD/score.c Wed Dec 23 17:47:03 1987
--- score.c Mon Mar 7 21:42:04 1988
***************
*** 15,20 ****
--- 15,21 ----
extern char *sys_errlist[];
extern char *sprintf();
+ /* returns whether the score file can be accessed */
score_board(Read, names)
{
struct scores *scp, *temp;
***************
*** 34,46 ****
#endif DEBUG
}
! /* read the top ten file into the array and close the file */
! if ((fd = open(SCOREFILE, O_RDWR)) == -1 ||
read(fd, (char *) top_ten, sizeof(top_ten)) == -1) {
msg("No score file:\n%s", sys_errlist[errno]);
! sleep(2);
remove_msgs(0);
! return;
}
/* Print the list */
--- 35,50 ----
#endif DEBUG
}
! /* read the top ten file into the array and close the file. If it doesn't
! * open for read/write, it probably doesn't exit -- create it rw for all.
! */
! if ((fd = open(SCOREFILE, O_RDWR)) == -1 &&
! (Read || (fd = open(SCOREFILE, O_WRONLY, 0666))) ||
read(fd, (char *) top_ten, sizeof(top_ten)) == -1) {
msg("No score file:\n%s", sys_errlist[errno]);
! Sleep(2);
remove_msgs(0);
! return -1;
}
/* Print the list */
***************
*** 75,80 ****
--- 79,85 ----
}
}
(void) close(fd);
+ return 0;
}
char *
***************
*** 102,114 ****
msg("MIDDLE button to decrement one character.\n");
msg("Use RETURN or RIGHT button to enter each letter.");
msg("Use <backspace> key to go back one position.");
! pw_text(draw_win, x, y, PIX_SRC, big_font, sprintf(s, "%d", score));
x += 25 * l_width(big_font);
(void) strcpy(buf, "AAA");
for (len = 0; len < 3;) {
! pw_text(draw_win, x - len*l_width(big_font), y, PIX_SRC, big_font, buf);
! pw_char(draw_win, x, y, PIX_SRC|PIX_DST, big_font, '_');
do window_read_event(Draw, &event);
while (event.ie_code == LOC_MOVE || event.ie_code == LOC_DRAG ||
--- 107,122 ----
msg("MIDDLE button to decrement one character.\n");
msg("Use RETURN or RIGHT button to enter each letter.");
msg("Use <backspace> key to go back one position.");
! pw_text(draw_win, x, y, PIX_SRC|PIX_COLOR(TEXT_COLOR), big_font,
! sprintf(s, "%d", score));
x += 25 * l_width(big_font);
(void) strcpy(buf, "AAA");
for (len = 0; len < 3;) {
! pw_text(draw_win, x - len*l_width(big_font), y,
! PIX_SRC|PIX_COLOR(TEXT_COLOR), big_font, buf);
! pw_char(draw_win, x, y, PIX_SRC|PIX_DST|PIX_COLOR(TEXT_COLOR),
! big_font, '_');
do window_read_event(Draw, &event);
while (event.ie_code == LOC_MOVE || event.ie_code == LOC_DRAG ||
*** OLD/sparks.c Mon Sep 7 18:55:05 1987
--- sparks.c Mon Mar 7 21:42:25 1988
***************
*** 35,43 ****
* move left-right or up-down the formula given finds which icon to use to
* to guarantee that it's not the last one used.
*/
! #define draw_spark(x, y) \
pw_rop(draw_win, pen_coord_x(x), pen_coord_y(y), 16,16, \
! XOR, spark_icons[(x + y) & 3], 0,0)
struct spark {
int x, y, oldx, oldy;
--- 35,43 ----
* move left-right or up-down the formula given finds which icon to use to
* to guarantee that it's not the last one used.
*/
! #define draw_spark(x, y, color) \
pw_rop(draw_win, pen_coord_x(x), pen_coord_y(y), 16,16, \
! XOR| PIX_COLOR(color), spark_icons[(x + y) & 3], 0,0)
struct spark {
int x, y, oldx, oldy;
***************
*** 107,112 ****
--- 107,113 ----
register int x, y, sp, move_clockwise, came_from, dir;
/* new spark x and y coord */
+ pw_putattributes(draw_win, &qix_mask);
for (sp = 0; sp < MAX_SPARKS; sp++) {
if (sparks[sp].x < 0)
break;
***************
*** 115,125 ****
* duced in pairs, the second spark will have the same coords and
* erase this mark. (clever, huh?)
*/
! draw_spark(sparks[sp].x, sparks[sp].y);
x = sparks[sp].x, y = sparks[sp].y;
/* user bit the big one */
if (x == pen_x && y == pen_y) {
! draw_spark(sparks[sp].x, sparks[sp].y); /* redraw the spark */
change_life(DIE);
return -1;
}
--- 116,128 ----
* duced in pairs, the second spark will have the same coords and
* erase this mark. (clever, huh?)
*/
! draw_spark(sparks[sp].x, sparks[sp].y,
! aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
x = sparks[sp].x, y = sparks[sp].y;
/* user bit the big one */
if (x == pen_x && y == pen_y) {
! draw_spark(sparks[sp].x, sparks[sp].y,
! aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
change_life(DIE);
return -1;
}
***************
*** 157,163 ****
box(convert_x(x)-10, convert_y(y)-10,
convert_x(x)+10, convert_y(y)+10, XOR);
msg("HALT! infinite-loop police! [y] (%d, %d)", x, y);
! sleep(2);
remove_msgs(0);
box(convert_x(x)-10, convert_y(y)-10,
convert_x(x)+10, convert_y(y)+10, XOR);
--- 160,166 ----
box(convert_x(x)-10, convert_y(y)-10,
convert_x(x)+10, convert_y(y)+10, XOR);
msg("HALT! infinite-loop police! [y] (%d, %d)", x, y);
! Sleep(2);
remove_msgs(0);
box(convert_x(x)-10, convert_y(y)-10,
convert_x(x)+10, convert_y(y)+10, XOR);
***************
*** 182,188 ****
sparks[sp].oldx = sparks[sp].x, sparks[sp].oldy = sparks[sp].y;
/* draw the new spark */
! draw_spark(x, y);
sparks[sp].x = x, sparks[sp].y = y;
if (x == pen_x && y == pen_y) {
--- 185,191 ----
sparks[sp].oldx = sparks[sp].x, sparks[sp].oldy = sparks[sp].y;
/* draw the new spark */
! draw_spark(x, y, aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
sparks[sp].x = x, sparks[sp].y = y;
if (x == pen_x && y == pen_y) {
***************
*** 198,214 ****
/* give the only warning we can without a sound chip :-) */
fputc(7, stderr), fflush(stderr);
msg("Sparx are now aggressive.");
! sleep(2);
remove_msgs(0);
aggressive = 1;
}
! if (sp == MAX_SPARKS)
return 0; /* no sparks left to start, so don't do a countdown */
}
! start_spark(BOARD_WIDTH/2, 0, TRUE);
! start_spark(BOARD_WIDTH/2, 0, FALSE);
! draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20, PIX_SRC);
! draw(BORDER, 21, BOARD_WIDTH_IN_PIXELS-BORDER, 21, PIX_SRC);
}
if (sp < MAX_SPARKS) {
/* calculate the percentage of the width of the board in pixels */
--- 201,224 ----
/* give the only warning we can without a sound chip :-) */
fputc(7, stderr), fflush(stderr);
msg("Sparx are now aggressive.");
! Sleep(2);
remove_msgs(0);
+ /* erase red sparks now or blue sparks will leave green */
+ toggle_sparks();
aggressive = 1;
+ /* now draw blue sparks */
+ toggle_sparks();
}
! if (sp == MAX_SPARKS) {
return 0; /* no sparks left to start, so don't do a countdown */
+ }
}
! start_spark(BOARD_WIDTH/2, 0);
! start_spark(BOARD_WIDTH/2, 0);
! draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20,
! PIX_SRC|PIX_COLOR(SPARKS_COLOR));
! draw(BORDER, 21, BOARD_WIDTH_IN_PIXELS-BORDER, 21,
! PIX_SRC|PIX_COLOR(SPARKS_COLOR));
}
if (sp < MAX_SPARKS) {
/* calculate the percentage of the width of the board in pixels */
***************
*** 236,248 ****
static x = -1, y;
int n;
if (x > -1)
! draw_spark(x, y);
if (!pos || !*pos) {
x = -1;
return 0;
}
! draw_spark((*pos)->x, (*pos)->y);
x = (*pos)->x, y = (*pos)->y;
if ((*pos)->x == pen_x && (*pos)->y == pen_y) {
--- 246,260 ----
static x = -1, y;
int n;
+ /* fuse is always red */
+ pw_putattributes(draw_win, &qix_mask);
if (x > -1)
! draw_spark(x, y, SPARKS_COLOR);
if (!pos || !*pos) {
x = -1;
return 0;
}
! draw_spark((*pos)->x, (*pos)->y, SPARKS_COLOR);
x = (*pos)->x, y = (*pos)->y;
if ((*pos)->x == pen_x && (*pos)->y == pen_y) {
***************
*** 263,272 ****
{
int n;
/* for each spark, if active, make it go away and reset to -1 */
for (n = 0; n < MAX_SPARKS; n++)
if (sparks[n].x > -1) {
! draw_spark(sparks[n].x, sparks[n].y);
sparks[n].oldx = sparks[n].x = -1;
}
draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20, PIX_CLR);
--- 275,286 ----
{
int n;
+ pw_putattributes(draw_win, &qix_mask);
/* for each spark, if active, make it go away and reset to -1 */
for (n = 0; n < MAX_SPARKS; n++)
if (sparks[n].x > -1) {
! draw_spark(sparks[n].x, sparks[n].y,
! aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
sparks[n].oldx = sparks[n].x = -1;
}
draw(BORDER, 20, BOARD_WIDTH_IN_PIXELS-BORDER, 20, PIX_CLR);
***************
*** 282,290 ****
{
register int sp;
for (sp = 0; sp < MAX_SPARKS; sp++) {
if (sparks[sp].x < 0)
break;
! draw_spark(sparks[sp].x, sparks[sp].y);
}
}
--- 296,306 ----
{
register int sp;
+ pw_putattributes(draw_win, &qix_mask);
for (sp = 0; sp < MAX_SPARKS; sp++) {
if (sparks[sp].x < 0)
break;
! draw_spark(sparks[sp].x, sparks[sp].y,
! aggressive? AGGR_SPARK_COLOR : SPARKS_COLOR);
}
}