/********************************** game_over.c **********************/ #include "sdi.h" /* * Copyright 1987 by Mark Weiser. * Permission to reproduce and use in any manner whatsoever on Suns is granted * so long as this copyright and other identifying marks of authorship * in the code and the game remain intact and visible. Use of this code * in other products is reserved to me--I'm working on Mac and IBM versions. */ /* * This file is responsible for flashing my face on the screen if the game ends * and 'non-stop' is not set. */ /* ORIGSIZE comes in from a -D in the makefile */ #ifndef ORIGSIZE #define ORIGSIZE 256 #endif #define NUMBER 10 #define BORDERSIZE 64 #define SIZE (ORIGSIZE+BORDERSIZE) static short message_data[] = { #include "bigmessage.h" }; mpr_static(origmessagepr, ORIGSIZE, ORIGSIZE, 1, message_data); static short tmp_data[ORIGSIZE*ORIGSIZE/8]; mpr_static(tmppr, ORIGSIZE, ORIGSIZE, 1, tmp_data); static short tmp2_data[SIZE*SIZE/8]; mpr_static(messagepr, SIZE, SIZE, 1, tmp2_data); /* * Routine to flash my face on the screen. * The pr_destroy order below is tricky, but there is no storage leak. */ do_game_over() { int center_x = max_x/2, center_y = max_y/2, circlesize; Xv_Window circlepr; int i; Xv_Window pw_a = citypw, pw_b = launchpw; pr_rop(&messagepr, 0, 0, SIZE, SIZE, PIX_SRC, 0, 0, 0); pr_rop(&messagepr, BORDERSIZE/2, BORDERSIZE/2, ORIGSIZE, ORIGSIZE, PIX_SRC, &origmessagepr, 0, 0); for(i=0; i 0) xv_destroy_safe(circlepr); circlesize = SIZE*(i+1)/(NUMBER); circlepr = make_circle(circlesize); do_picture(circlepr, circlesize, center_x, center_y, &messagepr, pw_a, pw_b); } #ifdef ORIG for(i=NUMBER-1; i > 0; i--) { /* clear the old circle (uses old pr and circlesize) */ do_picture(circlepr, circlesize, center_x, center_y, NULL, pw_a, pw_b); xv_destroy_safe(circlepr); /* make the new circle */ circlesize = SIZE*(i)/(NUMBER); circlepr = make_circle(circlesize); do_picture(circlepr, circlesize, center_x, center_y, &messagepr, pw_a, pw_b); } do_picture(circlepr, circlesize, center_x, center_y, NULL, pw_a, pw_b); #else for (i=0; i < (max_y+SIZE/2); i += 10) { do_picture(circlepr, circlesize, center_x, center_y+i, &messagepr, pw_a, pw_b); } #endif xv_destroy_safe(circlepr); } /* * Put up an instance of the final picture. */ do_picture(pr, size, x, y, messagepr, pw_a, pw_b) struct pixrect *pr, *messagepr; int size; Xv_Window pw_a, pw_b; { xv_rop(pr, 0, 0, size, size, PIX_SRC, messagepr, SIZE/2 - size/2, SIZE/2 - size/2); xv_rop(pw_a, x - size/2, y - size/2, size, size, PIX_SRC, pr, 0, 0); xv_rop(pw_b, x - size/2, y - size/2, size, size, PIX_SRC, pr, 0, 0); /* printf("SIZE, size, x, y, x - size/2, SIZE/2-size/2= %d, %d, %d, %d, %d, %d.\n", SIZE, size, x, y, x - size/2, SIZE/2-size/2); fflush(stdout); */ }