home *** CD-ROM | disk | FTP | other *** search
- /*
- * OGRE - a tactical ground combat game set in 2086.
- *
- * Written by Michael Caplinger of Rice University 1982
- * based on the Steve Jackson Microgame (c) 1977.
- *
- * Ported to Amiga from Unix by Hobie Orris, 1986
- * (who was too lazy to type in all the comments. Sorry)
- */
-
- #define MAIN 1
- #include "ext.h"
-
-
- main(argc, argv)
- int argc;
- char **argv;
- {
- int mark;
-
- /* The original program set a trap here: signal(SIGINT, handler)
- * For Amiga, I've chosen to handle close window events instead
- * of breaks; see Amiga_getchar() in termcap.c - H.O.
- */
-
- init_screen();
- mark = get_mark();
- init_units(mark);
- init_ogre(mark);
- disp_ogre_status(TRUE);
-
- while (1)
- {
- init_round();
-
- /* the Ogre fires */
-
- assign_fire_ogre();
- check_over();
-
- /* player moves and fires */
-
- move_def();
- attack_def();
- check_over();
-
- /* 2nd GEV move */
-
- init_gev2();
- move_def();
-
- /* Ogre moves */
-
- move_ogre();
- check_over();
- }
- }
-
-
- check_over()
- {
- char *message, c;
- int over,i;
- static char drawstring[] =
- "The Ogre self-destructs and destroys the CP. Draw!";
- static char youstring[] = "You win!";
- static char ogrestring[] = "The Ogre wins!";
-
- over = FALSE;
-
- if (unit[0].status == DESTROYED)
- {
- message = &ogrestring[0];
- over = TRUE;
- }
-
- /* if the Ogre is immobilized it is beaten */
-
- else if (ogre.movement == 0 && unit[0].range_to_ogre < 5)
- {
- /*
- * Optional rule 8.05 - the Ogre can self-destruct, destroying
- * everything within 4 hexes, and armor at 5 hexes is disabled.
- * So, if CP is within 4 hexes, blow up - H.O.
- */
-
- for (i = 0; i < n_units; ++i)
- {
- if (unit[i].range_to_ogre < 5)
- {
- unit[i].status = DESTROYED;
- disp_unit(i);
- }
- else if (unit[i].range_to_ogre == 5 && unit[i].status == OK &&
- unit[i].type != CP && unit[i].type != INFANTRY)
- {
- unit[i].status = DISABLED;
- disp_unit(i);
- }
- }
- disp_hex(ogre.l_hex, ogre.r_hex, '*');
- message = &drawstring[0];
- over = TRUE;
- }
- else if (ogre.movement == 0 && unit[0].range_to_ogre > 4)
- {
- message = &youstring[0];
- over = TRUE;
- }
-
- if (over)
- {
- puts(message);
- for (i = 16; i < 23; ++i)
- {
- movecur(i,1);
- eeol(i);
- }
- eeol(16);
- movecur(16,1);
- Amiga_puts(message);
- c = Amiga_getchar();
- reset_term();
- }
- }
-