Date: Wed, 4 Aug 93 23:06:09 PDT From: akrause AT saturn DOT SDSU DOT Edu (Alan Krause) To: djgpp AT sun DOT soe DOT clarkson DOT edu Ack! My program is locking up my computer so that only a hardware reset will get me back to the command line. The source follows. To compile, type: gcc prog.c -o prog -lgrx -lm You need not use the grx library, it will do the same thing with the regular gr library as well. The commands are: (i) - move up (k) - " " down (j) - turn left (l) - turn right To crash the program, try rotating in one direction by holding down the (j) or (l) keys. That oughtta do the trick. Any obvious / not so obvious errors/tips would be greatly appreciated.. -Alan Krause *------CUT Here--------* #include #include #include #define STEP 550 #define GRID 100 /* total field size (i.e. -100,100 x -100,100) */ #define RAD 20 /* radar's viewable radius */ #define CX 400 #define CY 300 #define RX 85 #define RY 75 #define FLAGCOLOR 14 #define TANKCOLOR 9 struct flag { int x; int y; int st; }; struct tank { double x; double y; double angle; int ammo; int shields; }; /***************************************/ /* Function prototypes... */ void draw_flags(struct tank, struct flag *, int, int); int main(void); /**************************************/ /* Subroutines used.... */ void draw_flags(struct tank t, struct flag f[], int n, int color) { int i; double a,d; /*printf("In draw_flags...");*/ for (i=0;i 2*PI) tk.angle-=2*PI; if (tk.angle < 0) tk.angle+=2*PI; /*printf("Tank angle: (%f) X: (%f) Y: (%f)\n",tk.angle,tk.x,tk.y);*/ } while (ch!='q'); GrSetMode(GR_default_text); }