[comp.sources.games] v11i096: sdi - missle command game for Suns, Patch1

billr@saab.CNA.TEK.COM (Bill Randle) (12/19/90)

Submitted-by: Bill Randle <billr@saab.CNA.TEK.COM>
Posting-number: Volume 11, Issue 96
Archive-name: sdi/Patch1
Patch-To: sdi: Volume 1, Issue 54-59
Environment: SunView

	[This is a games that has been around for quite awhile.
	 I received a bugfix from Brian Nakata last spring for
	 the duplicate printing of text. I made some changes to
	 get it to compile and run on a SparcStation (SunOS 4.1).
	 It is still a great game!  -br]

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  patches01
# Wrapped by billr@saab on Tue Dec 18 16:50:39 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patches01' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patches01'\"
else
echo shar: Extracting \"'patches01'\" \(9196 characters\)
sed "s/^X//" >'patches01' <<'END_OF_FILE'
X*** control_procs.c.orig	Tue Dec 18 11:55:45 1990
X--- control_procs.c	Tue Dec 18 16:30:09 1990
X***************
X*** 147,158 ****
X   * Proc called to display the scores from the score file in a popup window.
X   */
X  void
X! scores_proc(item, value, event)
X  Panel_item item;
X  Event *event;
X  {
X- 	Menu m;
X- 	int id = event_id(event);
X  	char *a;
X  	a = (char *)build_scores();
X  	easy_pop(a);
X--- 147,156 ----
X   * Proc called to display the scores from the score file in a popup window.
X   */
X  void
X! scores_proc(item, event)
X  Panel_item item;
X  Event *event;
X  {
X  	char *a;
X  	a = (char *)build_scores();
X  	easy_pop(a);
X*** helpers.c.orig	Tue Dec 18 11:55:36 1990
X--- helpers.c	Tue Dec 18 12:02:30 1990
X***************
X*** 22,28 ****
X  
X  
X  static short background_array[] = {
X! #include "/usr/include/images/square_17.pr"
X  };
X  mpr_static(background_pr, 16, 16, 1, background_array);
X  
X--- 22,28 ----
X  
X  
X  static short background_array[] = {
X! #include <images/square_17.pr>
X  };
X  mpr_static(background_pr, 16, 16, 1, background_array);
X  
X***************
X*** 141,147 ****
X  	}
X  	suspend_proc();
X  	init_popup_msg(frame, msg, lines);
X- 	textsw_insert(popup_text, msg, strlen(msg));
X  	window_set(popup_frame, WIN_X, event_x(event),
X  		WIN_Y, event_y(event),
X  		WIN_SHOW, TRUE,
X--- 141,146 ----
X*** makefile.orig	Tue Dec 18 16:36:49 1990
X--- makefile	Tue Dec 18 16:38:17 1990
X***************
X*** 44,50 ****
X  
X  #If you are running SUNOS 3.0, use this: CFLAGS = -DSUNOS3_0
X  
X! CFLAGS = -DSUNOS3_0
X  
X  LIBS = -lsuntool -lsunwindow -lpixrect -lm
X  
X--- 44,50 ----
X  
X  #If you are running SUNOS 3.0, use this: CFLAGS = -DSUNOS3_0
X  
X! CFLAGS = 
X  
X  LIBS = -lsuntool -lsunwindow -lpixrect -lm
X  
X*** menu.c.orig	Tue Dec 18 11:55:58 1990
X--- menu.c	Tue Dec 18 15:48:38 1990
X***************
X*** 1,5 ****
X--- 1,6 ----
X  #include <suntool/sunview.h>
X  #include <stdio.h>
X+ #include <varargs.h>
X  #include "walkmenu_impl.h"
X  #include "image_impl.h"
X  
X***************
X*** 22,51 ****
X   * Sun window library (at least a little bit).
X   */
X  
X  
X  void
X! pie_menu_set(m, arg)
X! struct menu *m;
X! int arg;
X  {
X! 	char **argptr = &(char *)arg;
X  	pie_menu_set_internal(m, argptr);
X  }
X  
X! pie_menu_item_set(mi, arg)
X! struct menu_item *mi;
X! int arg;
X  {
X! 	char **argptr = &(char *)arg;
X  	pie_menu_item_set_internal(mi, argptr);
X  }
X  
X  struct menu *
X! pie_menu_create(arg)
X! int arg;
X  {
X! 	char **argptr = &(char *)arg;
X  	struct menu *m;
X  	m = (struct menu *)calloc(sizeof(struct menu),1);
X  	m->item_list = (struct menu_item **)calloc(sizeof(struct menu_item *), MAX_ITEMS);
X  	m->max_nitems = MAX_ITEMS;
X--- 23,62 ----
X   * Sun window library (at least a little bit).
X   */
X  
X+ /*
X+  * re-written to use varargs so that it would run on a Sparc
X+  *	Bill Randle	12/18/90
X+  */
X  
X  void
X! pie_menu_set(va_alist)
X! va_dcl
X  {
X! 	va_list argptr;
X! 	struct menu *m;
X! 	va_start(argptr);
X! 	m = va_arg(argptr, struct menu *);
X  	pie_menu_set_internal(m, argptr);
X  }
X  
X! void
X! pie_menu_item_set(va_alist)
X! va_dcl
X  {
X! 	va_list argptr;
X! 	struct menu_item *mi;
X! 	va_start(argptr);
X! 	mi = va_arg(argptr, struct menu_item *);
X  	pie_menu_item_set_internal(mi, argptr);
X  }
X  
X  struct menu *
X! pie_menu_create(va_alist)
X! va_dcl
X  {
X! 	va_list argptr;
X  	struct menu *m;
X+ 	va_start(argptr);
X  	m = (struct menu *)calloc(sizeof(struct menu),1);
X  	m->item_list = (struct menu_item **)calloc(sizeof(struct menu_item *), MAX_ITEMS);
X  	m->max_nitems = MAX_ITEMS;
X***************
X*** 54,64 ****
X  }
X  
X  struct menu_item *
X! pie_menu_create_item(arg)
X! int arg;
X  {
X! 	char **argptr = &(char *)arg;
X  	struct menu_item *mi;
X  	mi = (struct menu_item *)calloc(sizeof(struct menu_item),1);
X  	mi->image = (struct image *)calloc(sizeof(struct image),1);
X  	pie_menu_item_set_internal(mi, argptr);
X--- 65,76 ----
X  }
X  
X  struct menu_item *
X! pie_menu_create_item(va_alist)
X! va_dcl
X  {
X! 	va_list argptr;
X  	struct menu_item *mi;
X+ 	va_start(argptr);
X  	mi = (struct menu_item *)calloc(sizeof(struct menu_item),1);
X  	mi->image = (struct image *)calloc(sizeof(struct image),1);
X  	pie_menu_item_set_internal(mi, argptr);
X***************
X*** 65,76 ****
X  	return mi;
X  }
X  
X! pie_menu_set_internal(m, argptr)
X  struct menu *m;
X! char **argptr;
X  {
X! 	while (*argptr != 0) {
X! 		switch(*argptr) {
X  			case MENU_APPEND_ITEM: {
X  				if (m->nitems >= (m->max_nitems-1))
X  					{
X--- 77,90 ----
X  	return mi;
X  }
X  
X! pie_menu_set_internal(m, ap)
X  struct menu *m;
X! va_list ap;
X  {
X! 	Menu_attribute arg;
X! 
X! 	while (arg = va_arg(ap, int)) {
X! 		switch(arg) {
X  			case MENU_APPEND_ITEM: {
X  				if (m->nitems >= (m->max_nitems-1))
X  					{
X***************
X*** 77,90 ****
X  					fprintf("Too many items in a pie menu.\n");
X  					abort();
X  				}
X! 				m->item_list[m->nitems] = (struct menu_item *)(*(argptr+1));
X  				((struct menu_item *)m->item_list[m->nitems])->parent = m;
X  				m->nitems += 1;
X! 				argptr += 2; break;
X  			}
X  			case MENU_NOTIFY_PROC: {
X! 				(caddr_t)m->notify_proc = (caddr_t)(*(argptr+1));
X! 				argptr += 2; break;
X  			}
X  			default: {
X  				fprintf(stderr, "Unexpected item in pie_menu_set_internal.\n");
X--- 91,104 ----
X  					fprintf("Too many items in a pie menu.\n");
X  					abort();
X  				}
X! 				m->item_list[m->nitems] = va_arg(ap, struct menu_item *);
X  				((struct menu_item *)m->item_list[m->nitems])->parent = m;
X  				m->nitems += 1;
X! 				break;
X  			}
X  			case MENU_NOTIFY_PROC: {
X! 				(caddr_t)m->notify_proc = va_arg(ap, caddr_t);
X! 				break;
X  			}
X  			default: {
X  				fprintf(stderr, "Unexpected item in pie_menu_set_internal.\n");
X***************
X*** 93,131 ****
X  			}
X  		}
X  	}
X  }
X  
X! pie_menu_item_set_internal(mi, argptr)
X  struct menu_item *mi;
X! char **argptr;
X  {
X! 	while (*argptr != 0) {
X! 		switch(*argptr) {
X  			case MENU_IMAGE:  {
X! 				mi->image->pr = (struct pixrect *)*(argptr+1);
X! 				argptr += 2; break;
X  			}
X  			case MENU_STRING: {
X! 				mi->image->string = (char *)*(argptr+1);
X! 				argptr += 2; break;
X  			}
X  			case MENU_PULLRIGHT: {
X  				mi->pullright = TRUE;
X! 				mi->value = (caddr_t)*(argptr+1);
X  				((struct menu *)mi->value)->parent = mi;
X! 				argptr += 2; break;
X  			}
X  			case MENU_RELEASE: {
X  				mi->free_item = TRUE;
X! 				argptr += 1; break;
X  			}
X  			case MENU_RELEASE_IMAGE: {
X  				mi->image->free_image = TRUE;
X! 				argptr += 1; break;
X  			}
X  			case MENU_CLIENT_DATA: {
X! 				mi->client_data = (caddr_t)*(argptr+1);
X! 				argptr += 2; break;
X  			}
X  			default: {
X  				fprintf(stderr, "Unexpected item in pie_menu_item_set_internal.\n");
X--- 107,148 ----
X  			}
X  		}
X  	}
X+ 	va_end(ap);
X  }
X  
X! pie_menu_item_set_internal(mi, ap)
X  struct menu_item *mi;
X! va_list ap;
X  {
X! 	Menu_attribute arg;
X! 
X! 	while (arg = va_arg(ap, int)) {
X! 		switch(arg) {
X  			case MENU_IMAGE:  {
X! 				mi->image->pr = va_arg(ap, struct pixrect *);
X! 				break;
X  			}
X  			case MENU_STRING: {
X! 				mi->image->string = va_arg(ap, char *);
X! 				break;
X  			}
X  			case MENU_PULLRIGHT: {
X  				mi->pullright = TRUE;
X! 				mi->value = va_arg(ap, caddr_t);
X  				((struct menu *)mi->value)->parent = mi;
X! 				break;
X  			}
X  			case MENU_RELEASE: {
X  				mi->free_item = TRUE;
X! 				break;
X  			}
X  			case MENU_RELEASE_IMAGE: {
X  				mi->image->free_image = TRUE;
X! 				break;
X  			}
X  			case MENU_CLIENT_DATA: {
X! 				mi->client_data = va_arg(ap, caddr_t);
X! 				break;
X  			}
X  			default: {
X  				fprintf(stderr, "Unexpected item in pie_menu_item_set_internal.\n");
X***************
X*** 134,139 ****
X--- 151,157 ----
X  			}
X  		}
X  	}
X+ 	va_end(ap);
X  }
X  
X  pie_menu_destroy(m)
X*** scores.c.orig	Tue Dec 18 11:55:49 1990
X--- scores.c	Tue Dec 18 16:17:49 1990
X***************
X*** 104,110 ****
X  	FILE *f;
X  	if (scorefile) {
X  		tmpfile = scorefile;
X! 	} else if ((tmpfile = getenv("SDI_SCORES")) == NULL) {
X  			tmpfile = scorefile;
X  	} else {
X  		tmpfile = "/usr/games/lib/sdi_scores";
X--- 104,110 ----
X  	FILE *f;
X  	if (scorefile) {
X  		tmpfile = scorefile;
X! 	} else if ((tmpfile = getenv("SDI_SCORES")) != NULL) {
X  			tmpfile = scorefile;
X  	} else {
X  		tmpfile = "/usr/games/lib/sdi_scores";
X*** source_converter.c.orig	Tue Dec 18 11:56:34 1990
X--- source_converter.c	Tue Dec 18 16:37:13 1990
X***************
X*** 27,33 ****
X  		fprintf(stderr, "Need an argument.\n");
X  		exit(1);
X  	}
X! 	printf(" .even\n__start_of_text:\n");
X  	while (! feof(stdin)) {
X  		p = buff;
X  		for (i = 0; i < OUTSIZE; i += 1) {
X--- 27,33 ----
X  		fprintf(stderr, "Need an argument.\n");
X  		exit(1);
X  	}
X! 	printf(" .align 4\n__start_of_text:\n");
X  	while (! feof(stdin)) {
X  		p = buff;
X  		for (i = 0; i < OUTSIZE; i += 1) {
X***************
X*** 53,60 ****
X  		printf(" .ascii \"%s\"\n", buff);
X  	}
X  	printf(" .ascii \"\\0\"\n",'\\');
X! 	printf(" .even\n");
X  	printf(" .globl _%s\n", argv[1]);
X  	printf("_%s:\n", argv[1]);
X  	printf(" .long __start_of_text\n");
X  }
X--- 53,65 ----
X  		printf(" .ascii \"%s\"\n", buff);
X  	}
X  	printf(" .ascii \"\\0\"\n",'\\');
X! 	printf(" .align 4\n");
X  	printf(" .globl _%s\n", argv[1]);
X  	printf("_%s:\n", argv[1]);
X+ #if defined(sparc)
X+ 	printf(" .word __start_of_text\n");
X+ #else
X  	printf(" .long __start_of_text\n");
X+ #endif
X+ 	exit(0);
X  }
END_OF_FILE
if test 9196 -ne `wc -c <'patches01'`; then
    echo shar: \"'patches01'\" unpacked with wrong size!
fi
# end of 'patches01'
fi
echo shar: End of shell archive.
exit 0