pfuetz@agd.fhg.de (02/26/91)
Submitted-by: pfuetz@agd.fhg.de Posting-number: Volume 11, Issue 99 Archive-name: xstrek/part13 #!/bin/sh # To unshare, sh or unshar this file echo xstrek/strek_main.c 1>&2 sed -e 's/^X//' > xstrek/strek_main.c <<'E!O!F! xstrek/strek_main.c' X/* strek_main.f -- translated by f2c (version of 19 December 1990 16:50:21). X You must link the resulting object file with the libraries: X -lF77 -lI77 -lm -lc (in that order) X*/ X X#include "f2c.h" X X/* Common Block Declarations */ X Xstruct { X char means[90]; X} key_defs__; X X#define key_defs__1 key_defs__ X X/* Table of constant values */ X Xstatic integer c__0 = 0; Xstatic integer c__3 = 3; Xstatic integer c__1 = 1; Xstatic real c_b38 = (float)1.; Xstatic real c_b39 = (float).6; Xstatic integer c__7 = 7; X X/* Main program */ MAIN__() X{ X /* Initialized data */ X X static integer index[10] = { 1,2,3,4,5,5,5,6,6,6 }; X static integer cm[3] = { 0,0,0 }; X static integer cs[3] = { 0,0,0 }; X static integer pc[3] = { 3,3,3 }; X static real rot_azm__[10] = { (float)0.,(float)-2.,(float)2.,(float)0.,( X float)0.,(float)-1.,(float)1.,(float)0.,(float)0.,(float)0. }; X static real rot_ang__[10] = { (float)2.,(float)0.,(float)0.,(float)-2.,( X float)1.,(float)0.,(float)0.,(float)-1.,(float)0.,(float)0. }; X static real rot_cost__[10] = { (float).25,(float).25,(float).25,(float) X .25,(float).25,(float).25,(float).25,(float).25,(float)0.,(float) X .25 }; X static logical rotate = TRUE_; X static integer r_index__ = 9; X static real photon_tr__[6] = { (float)900.,(float)900.,(float)900.,(float) X 900.,(float)900.,(float)900. }; X static real xc = (float)0.; X static shortint key_set__[16] = { 65535,65535,65535,65535,65535,65535, X 65535,65535,65535,65535,65535,65535,65535,65535,65535,65535 }; X static real yc = (float)-50.; X static real zc = (float)0.; X static real azm = (float)0.; X static real angle = (float)0.; X static integer photons = 20; X static real speed = (float)0.; X static real energy = (float)1e3; X static real damage = (float)0.; X static real d_pct__[6] = { (float)1.,(float)1.,(float)1.,(float)1.,(float) X 1.,(float)1. }; X static real odamage[10] = { (float)0.,(float)0.,(float)0.,(float)0.,( X float)0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0. }; X static integer ship_k__ = 0; X static real tr_cost__[10] = { (float)0.,(float).4,(float)2.,(float)2.,( X float)1.,(float)1.,(float)1.,(float)1.,(float)1.,(float)1. }; X static real obx[10] = { (float)0. }; X static real oby[10] = { (float)0. }; X static real obz[10] = { (float)0. }; X static real ospeed[10] = { (float)0.,(float)0.,(float)0.,(float)0.,(float) X 0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0. }; X static real oangle[10] = { (float)0.,(float)0.,(float)0.,(float)0.,(float) X 0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0. }; X static real oazm[10] = { (float)0.,(float)0.,(float)0.,(float)0.,(float) X 0.,(float)0.,(float)0.,(float)0.,(float)0.,(float)0. }; X static integer score = 0; X static real maxd[9] = { (float)5.,(float)0.,(float)0.,(float)12.5,(float) X 12.5,(float)12.5,(float)12.5,(float)12.5,(float)12.5 }; X static real value[9] = { (float)-200.,(float)300.,(float)300.,(float)0.,( X float)0.,(float)0.,(float)0.,(float)0.,(float)0. }; X static integer ship_r__ = 0; X static real sa = (float)0.; X static real ca = (float)1.; X static real sp = (float)0.; X static real cp = (float)1.; X static real rox[10] = { (float)0.,(float)0.,(float)0.,(float)0.,(float)0., X (float)0.,(float)0.,(float)0.,(float)0.,(float)0. }; X static real roy[10] = { (float)0.,(float)0.,(float)0.,(float)0.,(float)0., X (float)0.,(float)0.,(float)0.,(float)0.,(float)0. }; X static real roz[10] = { (float)0.,(float)0.,(float)0.,(float)0.,(float)0., X (float)0.,(float)0.,(float)0.,(float)0.,(float)0. }; X static logical scan = TRUE_; X static logical tract = TRUE_; X static logical phase = TRUE_; X static integer ship_n__ = 0; X static logical phase_d__ = FALSE_; X static logical tract_ob__ = FALSE_; X static integer scan_ob__ = 1; X static integer tr_object__ = 0; X static logical object[10] = { TRUE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_, X FALSE_,FALSE_,FALSE_,FALSE_ }; X static logical plot[10] = { FALSE_,FALSE_,FALSE_,FALSE_,FALSE_,FALSE_, X FALSE_,FALSE_,FALSE_,FALSE_ }; X static logical lock_on__ = FALSE_; X static logical refresh = TRUE_; X static char dam_rating__[10*3+1] = "light moderate heavy "; X static char t_message__[80*3+1] = "Which should I lock onto captain? \ X Input number of object to lock, \ X any other input = No lock on \ X "; X static integer dock_n__ = 0; X static char p_message__[80*3+1] = "Phaser control \ X Input number of object to lock ph\ Xasers on, any other input = No phaser l\ Xock on "; X static char e_message__[80*3+1] = "Photon Torpedo Trigger Radius Options\ X 1 = 15 2 = 20 3 = 25 4 = 30 5\ X = 35 6 = 40 Enter option. \ X "; X static char r_message__[80*3+1] = "Statistics for \ X Klingons Romulans Nemians Nemi\ Xans Docked Score Total \ X "; X static char a_message__[80*3+1] = " \ X \ X \ X "; X static char b_message__[80*3+1] = " \ X \ X \ X "; X static char k_message__[80*3+1] = " \ X \ X \ X "; X static char ap_message__[80*3+1] = "Ship hit by enemy photon! \ X \ X "; X static char d_message__[80*6+1] = " \ X Nemian freighter destroyed. \ X Enemy spacecraft destroyed. \ X Second enemy spacecraft d\ Xestroyed. Enemy photon torpedo \ Xdestroyed. Photon torpedo de\ Xstroyed. "; X static char l_message__[80*6+1] = "Navigation lock on star base. \ X Navigation lock on Nemian freight\ Xer. Navigation lock on enemy spac\ Xecraft. Navigation lock on second\ X enemy spacecraft. "; X static struct { X char fill_1[80]; X char e_2[240]; X char fill_3[160]; X } equiv_183 = { {0}, {'N', 'e', 'm', 'i', 'a', 'n', ' ', 'f', 'r', X 'e', 'i', 'g', 'h', 't', 'e', 'r', ' ', 'h', 'i', 't', ' ', X 'b', 'y', ' ', 'p', 'h', 'o', 't', 'o', 'n', ' ', 't', 'o', X 'r', 'p', 'e', 'd', 'o', '.', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'E', X 'n', 'e', 'm', 'y', ' ', 's', 'h', 'i', 'p', ' ', 'h', 'i', X 't', ' ', 'b', 'y', ' ', 'p', 'h', 'o', 't', 'o', 'n', ' ', X 't', 'o', 'r', 'p', 'e', 'd', 'o', '.', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'E', 'n', 'e', 'm', 'y', X ' ', 's', 'h', 'i', 'p', ' ', 'h', 'i', 't', ' ', 'b', 'y', X ' ', 'p', 'h', 'o', 't', 'o', 'n', ' ', 't', 'o', 'r', 'p', X 'e', 'd', 'o', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' '} }; X X#define ph_message__ ((char *)&equiv_183) X X static struct { X char fill_1[80]; X char e_2[400]; X } equiv_184 = { {0}, {'N', 'e', 'm', 'i', 'a', 'n', ' ', 'f', 'r', X 'e', 'i', 'g', 'h', 't', 'e', 'r', ' ', 'h', 'i', 't', ' ', X 'b', 'y', ' ', 'p', 'h', 'a', 's', 'e', 'r', ' ', 'f', 'i', X 'r', 'e', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'E', X 'n', 'e', 'm', 'y', ' ', 's', 'h', 'i', 'p', ' ', 'h', 'i', X 't', ' ', 'b', 'y', ' ', 'p', 'h', 'a', 's', 'e', 'r', ' ', X 'f', 'i', 'r', 'e', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'E', 'n', 'e', 'm', 'y', X ' ', 's', 'h', 'i', 'p', ' ', 'h', 'i', 't', ' ', 'b', 'y', X ' ', 'p', 'h', 'a', 's', 'e', 'r', ' ', 'f', 'i', 'r', 'e', X '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', 'E', 'n', 'e', 'm', 'y', ' ', 'P', 'h', 'o', X 't', 'o', 'n', ' ', 't', 'o', 'r', 'p', 'e', 'd', 'o', ' ', X 'h', 'i', 't', ' ', 'b', 'y', ' ', 'p', 'h', 'a', 's', 'e', X 'r', ' ', 'f', 'i', 'r', 'e', '.', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'P', X 'h', 'o', 't', 'o', 'n', ' ', 't', 'o', 'r', 'p', 'e', 'd', X 'o', ' ', 'h', 'i', 't', ' ', 'b', 'y', ' ', 'p', 'h', 'a', X 's', 'e', 'r', ' ', 'f', 'i', 'r', 'e', '.', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' '} }; X X#define ps_message__ ((char *)&equiv_184) X X static struct { X char fill_1[80]; X char e_2[80]; X char fill_3[160]; X char e_4[1040]; X } equiv_185 = { {0}, {'T', 'r', 'a', 'c', 't', 'o', 'r', ' ', 'b', X 'e', 'a', 'm', ' ', 'o', 'n', ' ', 'N', 'e', 'm', 'i', 'a', X 'n', ' ', 'f', 'r', 'e', 'i', 'g', 'h', 't', 'e', 'r', ' ', X 'd', 'r', 'o', 'p', 'p', 'e', 'd', '.', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {0}, { X 'T', 'r', 'a', 'c', 't', 'o', 'r', ' ', 'b', 'e', 'a', 'm', X ' ', 'o', 'n', ' ', 'e', 'n', 'e', 'm', 'y', ' ', 'p', 'h', X 'o', 't', 'o', 'n', ' ', 'd', 'r', 'o', 'p', 'p', 'e', 'd', X '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'T', 'r', 'a', 'c', X 't', 'o', 'r', ' ', 'b', 'e', 'a', 'm', ' ', 'o', 'n', ' ', X 'p', 'h', 'o', 't', 'o', 'n', ' ', 't', 'o', 'r', 'p', 'e', X 'd', 'o', ' ', 'd', 'r', 'o', 'p', 'p', 'e', 'd', '.', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', 'T', 'r', 'a', 'c', 't', 'o', 'r', ' ', X 'b', 'e', 'a', 'm', ' ', 'l', 'o', 'c', 'k', ' ', 'o', 'n', X ' ', 'd', 'r', 'o', 'p', 'p', 'e', 'd', '.', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X 'P', 'h', 'o', 't', 'o', 'n', ' ', 't', 'o', 'r', 'p', 'e', X 'd', 'o', ' ', 'l', 'a', 'u', 'n', 'c', 'h', 'e', 'd', ' ', X 's', 'i', 'r', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'I', '\'', 'm', ' ', X 'g', 'i', 'v', 'i', 'n', 'g', ' ', 'i', 't', ' ', 'a', 'l', X 'l', ' ', 's', 'h', 'e', '\'', 's', ' ', 'g', 'o', 't', ' ', X 'c', 'a', 'p', 't', 'a', 'i', 'n', '.', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', 'S', 'c', 'a', 'n', 'n', 'e', 'r', ' ', X 'l', 'o', 'c', 'k', ' ', 'o', 'n', ' ', 'l', 'o', 's', 't', X '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X 'N', 'e', 'm', 'i', 'a', 'n', ' ', 'f', 'r', 'e', 'i', 'g', X 'h', 't', 'e', 'r', ' ', 'd', 'o', 'c', 'k', 'e', 'd', ' ', X 'a', 't', ' ', 's', 't', 'a', 'r', ' ', 'b', 'a', 's', 'e', X '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'S', 'c', 'o', 'r', X 'e', ' ', 'f', 'o', 'r', ' ', 'd', 'e', 's', 't', 'r', 'o', X 'y', 'i', 'n', 'g', ' ', 's', 'h', 'i', 'p', ':', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', 'G', 'o', 'o', 'd', ' ', 'g', 'o', 'i', X 'n', 'g', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X 'S', 'c', 'a', 'n', 'n', 'e', 'r', 's', ' ', 'r', 'e', 'p', X 'o', 'r', 't', ' ', 't', 'h', 'a', 't', ' ', 't', 'h', 'e', X ' ', 'd', 'a', 'm', 'a', 'g', 'e', ' ', 'w', 'a', 's', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'R', 'e', 'p', 'a', X 'i', 'r', ' ', 'p', 'a', 'r', 't', 'i', 'e', 's', ' ', 'r', X 'e', 'p', 'o', 'r', 't', ' ', 't', 'h', 'a', 't', ' ', 't', X 'h', 'e', ' ', 'd', 'a', 'm', 'a', 'g', 'e', ' ', 'w', 'a', X 's', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', 'P', 'o', 'i', 'n', 't', 's', ' ', 'l', X 'o', 's', 't', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X 'I', 't', '\'', 's', ' ', 'y', 'o', 'u', 'r', ' ', 'j', 'o', X 'b', ' ', 't', 'o', ' ', 'd', 'e', 'f', 'e', 'n', 'd', ' ', X 't', 'h', 'e', ' ', 'N', 'e', 'm', 'i', 'a', 'n', 's', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '} }; X X#define s_message__ ((char *)&equiv_185) X X static char sc_message__[80*6+1] = "Scanner locked on starbase. \ X Scanner locked on Nemian freight\ Xer. Scanner locked on enemy ship\ X. Scanner locked on second\ X enemy ship. Scanner locked on en\ Xemy photon. Scanner locked o\ Xn photon torpedo. "; X static struct { X char fill_1[80]; X char e_2[80]; X char fill_3[160]; X char e_4[160]; X } equiv_186 = { {0}, {'N', 'e', 'm', 'i', 'a', 'n', ' ', 'f', 'r', X 'e', 'i', 'g', 'h', 't', 'e', 'r', ' ', 'i', 'n', ' ', 't', X 'r', 'a', 'c', 't', 'o', 'r', ' ', 'b', 'e', 'a', 'm', '.', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}, {0}, { X 'E', 'n', 'e', 'm', 'y', ' ', 'p', 'h', 'o', 't', 'o', 'n', X ' ', 'i', 'n', ' ', 't', 'r', 'a', 'c', 't', 'o', 'r', ' ', X 'b', 'e', 'a', 'm', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'P', 'h', 'o', 't', X 'o', 'n', ' ', 't', 'o', 'r', 'p', 'e', 'd', 'o', ' ', 'i', X 'n', ' ', 't', 'r', 'a', 'c', 't', 'o', 'r', ' ', 'b', 'e', X 'a', 'm', '.', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', X ' ', ' ', ' ', ' '} }; X X#define u_message__ ((char *)&equiv_186) X X static char sl_message__[80*3+1] = "Game put on hold. \ X STREK will not start again until\ X another key is hit. \ X "; X static integer waited = 0; X static integer turns_wait__ = 0; X X /* System generated locals */ X integer i__1, i__2, i__3, i__4; X real r__1, r__2, r__3; X X /* Builtin functions */ X /* Subroutine */ int s_copy(); X integer s_wsfi(), do_fio(), e_wsfi(); X double sqrt(), sin(), cos(), r_sign(), atan(); X integer s_rsfi(), e_rsfi(); X /* Subroutine */ int s_stop(); X integer i_nint(); X X /* Local variables */ X extern /* Subroutine */ int strek_assess_damage__(), X strek_photon_damage__(), strek_no_energy__(); X static real seed; X extern /* Subroutine */ int rand_(); X static integer rate; X extern /* Subroutine */ int gprsetdrawvalue_(); X static integer item, l_object__; X static real dist; X static char key_file__[256]; X static real distance[30] /* was [3][10] */, razm[3], tazm; X static integer type, photon_c__[6]; X static doublereal turn; X static logical new_ship__; X extern /* Subroutine */ int strek_interpret_key__(), timewait_(); X static doublereal duration; X extern /* Subroutine */ int strek_nemian__(); X static real timerelative; X static integer i, j, k; X static real check, brake[3], gprkeystroke; X extern /* Subroutine */ int strek_move_enemy__(); X static shortint clock[3]; X static integer nav_c__; X extern logical gprcondeventwait_(); X static shortint c_pos__[2]; X static char nick_name__[10], capt_name__[10]; X static integer ph_object__; X static char t_key__[1]; X static shortint timer[3]; X static char ship_name__[30]; X static real pro_x__[10], pro_y__[10], trazm; X static integer cum_score__; X static char user_name__[10]; X static logical found, kling[3]; X extern /* Subroutine */ int timeclock_(), calfloatclock_(); X static real s1, s2, s3, t1, t2, t3, t4, ran_store__[10], t5, t6; X extern /* Subroutine */ int strek_number_objects__(), strek_damage_info__( X ); X static integer num_times__; X static real tempx, tempy, tempz; X static shortint font_3__, font_4__; X extern /* Subroutine */ int strek_message__(); X static integer pos_store__[20] /* was [10][2] */; X extern /* Subroutine */ int strek_scanner__(), strek_x_hairs__(), X strek_place_enemy__(), strek_klingon__(), strek_phaser_fire__(), X strek_screen_init__(); X static real dx, dy, dz, rangle[3]; X extern /* Subroutine */ int strek_startup__(); X static real tangle, orange[10], xt[10], yt[10]; X static shortint center[2]; X static integer trange; X static real zt[10]; X extern /* Subroutine */ int strek_enemy_setup__(), strek_photon_1__(), X strek_photon_2__(), strek_photon_3__(), strek_photon_4__(), X strek_photon_5__(), strek_photon_6__(), strek_dock__(); X static integer option; X static real trdist; X static integer last_score__, status; X extern /* Subroutine */ int strek_find_free_ob__(); X static logical unobscured; X static real xt1, yt1, zt1; X extern /* Subroutine */ int strek_place_nemian__(); X static shortint event_type__; X static real gprnoevent; X extern /* Subroutine */ int strek_starbase__(), gprenableinput_(), X strek_flashers__(); X static real coa[9]; X extern /* Subroutine */ int strek_update_panel__(); X static logical agr[3]; X static integer phase_c__; X static real soa[9], cop[9]; X static char key[1]; X static doublereal elapsed; X static integer txc, tyc, tzc; X static real sop[9]; X extern /* Subroutine */ int strek_draw_phasers__(); X static integer bitmap_desc__; X static real trangle, trx, try_, trz; X static logical two; X extern /* Subroutine */ int strek_romulan_1__(), strek_romulan_2__(); X static logical reverse; X extern /* Subroutine */ int calgetlocaltime_(); X static integer num_forward__; X X /* Fortran I/O blocks */ X static icilist io___99 = { 0, a_message__+160, 0, "(a36,a10)", 80, 1 }; X static icilist io___100 = { 0, ap_message__+160, 0, "(a42,a10)", 80, 1 }; X static icilist io___111 = { 0, k_message__+80, 0, "(a27,f10.2)", 80, 1 }; X static icilist io___112 = { 0, k_message__+160, 0, "(a11,a10)", 80, 1 }; X static icilist io___113 = { 0, k_message__+80, 0, "(a13,f10.2)", 80, 1 }; X static icilist io___114 = { 0, k_message__+160, 0, "(a36,a10)", 80, 1 }; X static icilist io___150 = { 0, t_key__, 0, "(i1)", 1, 1 }; X static icilist io___153 = { 0, t_key__, 0, "(i1)", 1, 1 }; X static icilist io___155 = { 0, a_message__+160, 0, "(a36,a10)", 80, 1 }; X static icilist io___156 = { 0, t_key__, 0, "(i1)", 1, 1 }; X static icilist io___158 = { 0, key, 0, "(i1)", 1, 1 }; X static icilist io___160 = { 0, t_key__, 0, "(i1)", 1, 1 }; X static icilist io___161 = { 0, r_message__, 0, "(a15,a30)", 80, 1 }; X static icilist io___162 = { 0, r_message__+160, 0, "(i8,i10,i9,i16,2i7)", X 80, 1 }; X X X X/* ******************************************************************* X*/ X/* ***** ***** X*/ X/* ***** STAR TREK VERSION 3.0 ***** X*/ X/* ***** ***** X*/ X/* ***** written by ***** X*/ X/* ***** ***** X*/ X/* ***** Justin S. Revenaugh ***** X*/ X/* ***** ***** X*/ X/* ***** 7/87 ***** X*/ X/* ***** ***** X*/ X/* ***** Massachussetts Institute of Technology ***** X*/ X/* ***** Department of Earth, Atmospheric and Planetary Science ***** X*/ X/* ***** ***** X*/ X/* ******************************************************************* X*/ X X/* STREK_MAIN is the main calling code for the STREK system. */ X/* It handles the database startup calls, graphics init call, */ X/* the screen update - resolve - key request sequence. */ X/* When the ship docks or dies it updates the database. */ X X/* version 2.0 */ X X/* % include '/sys/ins/base.ins.ftn' */ X/* % include '/sys/ins/gpr.ins.ftn' */ X/* % include '/sys/ins/smdu.ins.ftn' */ X/* % include '/sys/ins/time.ins.ftn' */ X/* % include '/sys/ins/cal.ins.ftn' */ X X/* STREK declarations */ X X X/* real variables (all ship position data) */ X X X/* message strings */ X X X/* logical toggles for objects */ X X X/* key interpretation common */ X X X/* data for STREK */ X X X/* statement functions for converting angles to rads */ X/* and vice-versa */ X X X/* call STREK_STARTUP to init db and get ship info */ X X strek_startup__(user_name__, capt_name__, nick_name__, ship_name__, & X last_score__, &cum_score__, key_file__, &new_ship__, 10L, 10L, X 10L, 30L, 256L); X X/* call STREK_SCREEN_INIT */ X X strek_screen_init__(&bitmap_desc__, &font_3__, &font_4__); X X/* enable keystroke events */ X X gprenableinput_(&gprkeystroke, key_set__, &status); X X/* startup info panels (4 passes to init everything) */ X X for (j = 1; j <= 4; ++j) { X i__1 = (integer) energy; X i__2 = (integer) xc; X i__3 = (integer) yc; X i__4 = (integer) zc; X strek_update_panel__(&c__0, &i__1, &photons, &phase, &tract_ob__, & X i__2, &i__3, &i__4, &scan, &c__0, &c__0, &c__0, &c__0, & X scan_ob__); X/* L5: */ X } X X/* give an introductory message */ X X s_copy(b_message__ + 80, "Welcome aboard sir, the bridge is all yours!", X 80L, 44L); X strek_message__(b_message__, &c__3, 80L); X X/* call clock to get a random number seed */ X X calgetlocaltime_(clock); X seed = (r__1 = clock[2] / (float)3.3e4, dabs(r__1)); X X/* start turn timer */ X X timeclock_(timer); X calfloatclock_(timer, &elapsed); X X/* get a nemian */ X X strek_place_nemian__(&xc, &yc, &zc, &obx[1], &oby[1], &obz[1], &oazm[1], & X oangle[1], &ospeed[1], &seed); X object[1] = TRUE_; X odamage[1] = (float)0.; X X/* begin event driver loop */ X XL10: X X/* check phaser availability */ X X if (! phase && phase_d__) { X ++phase_c__; X if (phase_c__ > 40) { X phase_d__ = FALSE_; X phase = TRUE_; X } X } X X/* if nemian is getting too far away then refresh him */ X X if (orange[1] > (float)9e6) { X object[1] = FALSE_; X } X X/* if there's no nemian then get one */ X X if (! object[1]) { X strek_place_nemian__(&xc, &yc, &zc, &obx[1], &oby[1], &obz[1], &oazm[ X 1], &oangle[1], &ospeed[1], &seed); X object[1] = TRUE_; X odamage[1] = (float)0.; X X/* check for nemian docking */ X X } else if (tr_object__ == 1 && tract_ob__) { X if (distance[0] < (float)900. && dabs(speed) <= (float)1.) { X score += 500; X s_copy(b_message__ + 80, s_message__ + 800, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X tract_ob__ = FALSE_; X object[1] = FALSE_; X ++dock_n__; X } X } X X/* check for photon proximity explosions */ X X for (j = 4; j <= 9; ++j) { X if (object[j]) { X ++photon_c__[j - 4]; X if (photon_c__[j - 4] > 60) { X object[j] = FALSE_; X } X if (j > 6) { X for (i = 1; i <= 3; ++i) { X if (object[i] && (distance[i + j * 3 - 1] <= photon_tr__[ X j - 4] && orange[j] > (float)1600.)) { X object[j] = FALSE_; X strek_photon_damage__(&distance[i + j * 3 - 1], & X odamage[i], &seed, &type); X s_copy(a_message__, ph_message__ + (index[i] - 1) * X 80, 80L, 80L); X s_wsfi(&io___99); X do_fio(&c__1, s_message__ + 1040, 80L); X do_fio(&c__1, dam_rating__ + (type - 1) * 10, 10L); X e_wsfi(); X strek_message__(a_message__, &c__3, 80L); X } X/* L30: */ X } X } else { X X/* check for nemian hits */ X X if (object[1] && distance[j * 3] < photon_tr__[j - 4]) { X if (! object[2] || distance[j * 3 + 1] > (float)900.) { X if (! object[3] || distance[j * 3 + 2] > (float)900.) X { X object[j] = FALSE_; X strek_photon_damage__(&distance[j * 3], &odamage[ X 1], &seed, &type); X } X } X } X X/* check for player ship hits */ X X if (orange[j] < photon_tr__[j - 4]) { X if (! object[2] || distance[j * 3 + 1] > (float)225.) { X if (! object[3] || distance[j * 3 + 2] > (float)225.) X { X object[j] = FALSE_; X strek_photon_damage__(&orange[j], &damage, &seed, X &type); X s_wsfi(&io___100); X do_fio(&c__1, s_message__ + 1120, 80L); X do_fio(&c__1, dam_rating__ + (type - 1) * 10, 10L) X ; X e_wsfi(); X strek_message__(ap_message__, &c__3, 80L); X } X } X } X } X } X/* L20: */ X } X X/* if enemy ships are alive then move 'em */ X X if (object[2] || object[3]) { X for (j = 2; j <= 3; ++j) { X if (object[j]) { X strek_move_enemy__(&j, obx, oby, obz, oazm, oangle, ospeed, & X xc, &yc, &zc, &azm, &angle, &speed, &agr[j - 1], X object, &rox[j], &roy[j], &roz[j], odamage, &pc[j - 1] X , distance, &kling[j - 1], &cm[j - 1], &cs[j - 1], X orange, &razm[j - 1], &rangle[j - 1], &brake[j - 1], & X damage, photon_c__, &phase_c__, pro_x__, pro_y__, & X seed, center); X } X/* L50: */ X } X } else if (waited > turns_wait__) { X X/* reset damage totals, pick ship type and aggression levels */ X X strek_enemy_setup__(odamage, agr, kling, maxd, object, &seed, &two, X pc); X j = 2; X k = 3; X if (two) { X strek_place_enemy__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], & X oazm[j], &oangle[j], &ospeed[j], &seed); X strek_place_enemy__(&xc, &yc, &zc, &obx[k], &oby[k], &obz[k], & X oazm[k], &oangle[k], &ospeed[k], &seed); X } else { X strek_place_enemy__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], & X oazm[j], &oangle[j], &ospeed[j], &seed); X } X waited = 0; X } else if (waited == 0) { X rand_(&seed); X turns_wait__ = seed * (float)150. + 50; X waited = 1; X } else { X ++waited; X } X X/* evaluate sum of damages (both photon and phaser) to other objects */ X X X for (j = 1; j <= 9; ++j) { X if (object[j] && odamage[j] >= maxd[j - 1]) { X if (j == 1) { X ++ship_n__; X } else if (kling[j - 1]) { X ++ship_k__; X } else { X ++ship_r__; X } X object[j] = FALSE_; X s_copy(k_message__, d_message__ + (index[j] - 1) * 80, 80L, 80L); X if (j == 2 || j == 3) { X s_wsfi(&io___111); X do_fio(&c__1, s_message__ + 880, 80L); X do_fio(&c__1, (char *)&value[j - 1], (ftnlen)sizeof(real)); X e_wsfi(); X s_wsfi(&io___112); X do_fio(&c__1, s_message__ + 960, 80L); X do_fio(&c__1, nick_name__, 10L); X e_wsfi(); X } else if (j == 1) { X s_wsfi(&io___113); X do_fio(&c__1, s_message__ + 1200, 80L); X do_fio(&c__1, (char *)&value[j - 1], (ftnlen)sizeof(real)); X e_wsfi(); X s_wsfi(&io___114); X do_fio(&c__1, s_message__ + 1280, 80L); X do_fio(&c__1, capt_name__, 10L); X e_wsfi(); X rand_(&seed); X if (seed > (float).5) { X agr[1] = FALSE_; X } X rand_(&seed); X if (seed > (float).5) { X agr[2] = FALSE_; X } X } else { X s_copy(k_message__ + 80, k_message__, 80L, 80L); X s_copy(k_message__, " ", 80L, 1L); X s_copy(k_message__ + 160, " ", 80L, 1L); X } X strek_message__(k_message__, &c__3, 80L); X score += value[j - 1]; X } X/* L40: */ X } X X/* process lock on coordinates */ X X ++nav_c__; X if (lock_on__) { X if (orange[l_object__] > (float)1e4 && nav_c__ >= 10) { X nav_c__ = 0; X if (speed < (float)0.) { X s1 = -(doublereal)speed; X s2 = azm + (float)180.; X if (s2 > (float)360.) { X s2 += (float)-360.; X } X s3 = (float)360. - angle; X reverse = TRUE_; X } else { X s1 = speed; X s2 = azm; X s3 = angle; X reverse = FALSE_; X } X if (s1 > (float).01) { X num_forward__ = sqrt(orange[l_object__]) / s1; X } else { X num_forward__ = 20; X } X j = l_object__; X xt1 = -num_forward__ * ospeed[j] * sin(oazm[j]) * cos(oangle[j]) X + obx[j]; X yt1 = num_forward__ * ospeed[j] * cos(oazm[j]) * cos(oangle[j]) + X oby[j]; X zt1 = num_forward__ * ospeed[j] * sin(oangle[j]) + obz[j]; X dx = xt1 - xc; X dy = yt1 - yc; X dz = zt1 - zc; X if (dabs(dy) < (float)1.) { X dy = r_sign(&c_b38, &dy); X } X if (dy <= (float)0.) { X r__1 = atan(dx / dy); X tazm = -(doublereal)(r__1 * (float)180. / (float)3.141592653) X + (float)180.; X } else { X r__1 = atan(dx / dy); X tazm = -(doublereal)(r__1 * (float)180. / (float)3.141592653); X X } X if (tazm < (float)0.) { X tazm += (float)360.; X } X/* Computing 2nd power */ X r__1 = dx; X/* Computing 2nd power */ X r__2 = dy; X dist = sqrt(r__1 * r__1 + r__2 * r__2); X if (dist < (float)1.) { X dist = (float)1.; X } X r__1 = atan(dz / dist); X tangle = r__1 * (float)180. / (float)3.141592653; X X/* pick smallest angle (needed due to arctan being only in */ X/* I and IV quadrants */ X X t1 = (tazm - s2) / (float)10.; X t2 = (tangle - s3) / (float)10.; X t3 = (tazm - (s2 + (float)360.)) / (float)10.; X t4 = (tangle - (s3 + (float)360.)) / (float)10.; X t5 = (tazm - (s2 - (float)360.)) / (float)10.; X t6 = (tangle - (s3 - (float)360.)) / (float)10.; X if (dabs(t3) < dabs(t1)) { X t1 = t3; X } X if (dabs(t5) < dabs(t1)) { X t1 = t5; X } X if (dabs(t4) < dabs(t2)) { X t2 = t4; X } X if (dabs(t6) < dabs(t2)) { X t2 = t6; X } X if (reverse) { X t2 = -(doublereal)t2; X } X X/* limit rotation angles by max ship ability */ X X if (dabs(t1) > (float).6) { X t1 = r_sign(&c_b39, &t1); X } X if (dabs(t2) > (float).6) { X t2 = r_sign(&c_b39, &t2); X } X X/* set rotation vars */ X X rot_azm__[9] = t1; X rot_ang__[9] = t2; X } X } X X/* if rotate then rotate */ X X if (rot_azm__[r_index__ - 1] != (float)0.) { X azm += rot_azm__[r_index__ - 1]; X sa = sin(azm * (float)3.141592653 / (float)180.); X ca = cos(azm * (float)3.141592653 / (float)180.); X } X if (rot_ang__[r_index__ - 1] != (float)0.) { X angle += rot_ang__[r_index__ - 1]; X sp = sin(angle * (float)3.141592653 / (float)180.); X cp = cos(angle * (float)3.141592653 / (float)180.); X } X if (! rotate && ! lock_on__) { X r_index__ = 9; X } X X/* rotate tractored object back to translated galatic coords centered X*/ X/* on ship */ X X if (tract_ob__ && tract) { X if (! object[tr_object__]) { X tract_ob__ = FALSE_; X s_copy(b_message__ + 80, s_message__ + (index[tr_object__] - 1) * X 80, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X } else { X trazm += rot_azm__[r_index__ - 1] * (float)3.141592653 / (float) X 180.; X t1 = cos(trazm - azm * (float)3.141592653 / (float)180.); X trangle += rot_ang__[r_index__ - 1] * (float)3.141592653 / (float) X 180. * t1; X j = tr_object__; X trx = rox[j] * ca - roy[j] * sa * cp + roz[j] * sa * sp + xc; X try_ = rox[j] * sa + roy[j] * ca * cp - roz[j] * ca * sp + yc; X trz = roy[j] * sp + roz[j] * cp + zc; X } X } X X/* check that scan object still exists */ X X if (! object[scan_ob__] && scan_ob__ >= 4) { X scan_ob__ = 1; X s_copy(b_message__ + 80, s_message__ + 720, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X } X X/* check that nav lock on object still exists */ X X if (lock_on__ && (! object[l_object__] || orange[l_object__] < (float)1e4 X || ! scan)) { X lock_on__ = FALSE_; X s_copy(b_message__ + 80, "Navigation lock on lost.", 80L, 24L); X strek_message__(b_message__, &c__3, 80L); X r_index__ = 9; X } X X/* apply damage to the player's ship */ X X strek_assess_damage__(d_pct__, &damage, &scan, &tract, &phase, &energy, & X seed); X X/* get a key if one has been struck */ X X unobscured = gprcondeventwait_(&event_type__, key, c_pos__, &status, 1L); X if ((real) event_type__ != gprnoevent) { X strek_interpret_key__(key, 1L); X X/* process a speed key */ X X if (*key == 'a') { X speed += (float).5; X if (speed > (float)5.) { X speed = (float)5.; X s_copy(b_message__ + 80, s_message__ + 640, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X } X } else if (*key == 's') { X speed += (float)-.5; X if (speed < (float)-5.) { X speed = (float)-5.; X s_copy(b_message__ + 80, s_message__ + 640, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X } X } X X/* process a rotate key */ X X if (! lock_on__) { X if (*key == 'm') { X r_index__ = 9; X } else if (*key == 'b') { X rotate = ! rotate; X } else { X if (! rotate) { X if (*key == 'u') { X r_index__ = 1; X } else if (*key == 'j') { X r_index__ = 2; X } else if (*key == 'h') { X r_index__ = 3; X } else if (*key == 'n') { X r_index__ = 4; X } X } else { X if (*key == 'u') { X r_index__ = 5; X } else if (*key == 'j') { X r_index__ = 6; X } else if (*key == 'h') { X r_index__ = 7; X } else if (*key == 'n') { X r_index__ = 8; X } X } X } X } X X/* process a tractor beam key */ X X if (*key == 't' && tract && ! tract_ob__) { X strek_number_objects__(pos_store__, ran_store__, object, &c__1); X strek_message__(t_message__, &c__3, 80L); X i = 0; XL60: X ++i; X unobscured = gprcondeventwait_(&event_type__, t_key__, c_pos__, & X status, 1L); X if ((real) event_type__ != gprnoevent || i > 3000) { X goto L70; X } X goto L60; XL70: X strek_number_objects__(pos_store__, ran_store__, object, &c__0); X if ((real) event_type__ != gprnoevent) { X strek_interpret_key__(t_key__, 1L); X if (*t_key__ == '1' || *t_key__ >= '4' && *t_key__ <= '9') { X s_rsfi(&io___150); X do_fio(&c__1, (char *)&tr_object__, (ftnlen)sizeof( X integer)); X e_rsfi(); X if (object[tr_object__] && orange[tr_object__] < (float) X 9e4) { X tract_ob__ = TRUE_; X j = tr_object__; X trx = obx[j]; X try_ = oby[j]; X trz = obz[j]; X trazm = oazm[j]; X trangle = oangle[j]; X trdist = orange[j]; X s_copy(b_message__ + 80, u_message__ + (index[j] - 1) X * 80, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X } X } X } X } X X/* process a drop tractor key */ X X if (*key == 'r' && tract_ob__) { X tract_ob__ = FALSE_; X oazm[tr_object__] = trazm; X oangle[tr_object__] = trangle; X s_copy(b_message__ + 80, s_message__ + 480, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X } X X/* process an damage information key */ X X if (*key == 'i') { X strek_damage_info__(d_pct__, capt_name__, nick_name__, 10L, 10L); X } X X/* process a photon key */ X X if (*key == 'f' && photons >= 1) { X strek_find_free_ob__(object, &c__7, &j, &found); X if (found) { X object[j] = TRUE_; X photon_c__[j - 4] = 0; X --photons; X obx[j] = xc; X oby[j] = yc; X obz[j] = zc; X oazm[j] = azm * (float)3.141592653 / (float)180.; X oangle[j] = angle * (float)3.141592653 / (float)180.; X ospeed[j] = (float)10.; X s_copy(b_message__ + 80, s_message__ + 560, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X } X } X X/* process a phaser key */ X X if (*key == 'p' && phase && energy > (float)30.) { X strek_number_objects__(pos_store__, ran_store__, object, &c__1); X strek_message__(p_message__, &c__3, 80L); X i = 0; XL80: X ++i; X unobscured = gprcondeventwait_(&event_type__, t_key__, c_pos__, & X status, 1L); X if ((real) event_type__ != gprnoevent || i > 3000) { X goto L90; X } X goto L80; XL90: X strek_number_objects__(pos_store__, ran_store__, object, &c__0); X if ((real) event_type__ != gprnoevent) { X strek_interpret_key__(t_key__, 1L); X if (*t_key__ >= '0' && *t_key__ <= '9') { X s_rsfi(&io___153); X do_fio(&c__1, (char *)&ph_object__, (ftnlen)sizeof( X integer)); X e_rsfi(); X if (object[ph_object__] && orange[ph_object__] < (float) X 2.5e5) { X if (pro_x__[ph_object__] <= (float)800. && pro_x__[ X ph_object__] >= (float)100. && (pro_y__[ X ph_object__] <= (float)700. && pro_y__[ X ph_object__] >= (float)100.)) { X i__1 = (integer) pro_x__[ph_object__]; X i__2 = (integer) pro_y__[ph_object__]; X strek_draw_phasers__(&i__1, &i__2); X energy += (float)-30.; X phase_d__ = TRUE_; X phase_c__ = 0; X phase = FALSE_; X X/* do damage to other ship */ X X strek_phaser_fire__(&orange[ph_object__], &seed, & X odamage[ph_object__], &type); X s_copy(a_message__, ps_message__ + (index[ X ph_object__] - 1) * 80, 80L, 80L); X s_wsfi(&io___155); X do_fio(&c__1, s_message__ + 1040, 80L); X do_fio(&c__1, dam_rating__ + (type - 1) * 10, 10L) X ; X e_wsfi(); X strek_message__(a_message__, &c__3, 80L); X } X } X } X } X } X X/* process a explode radius key */ X X if (*key == 'e') { X strek_message__(e_message__, &c__3, 80L); X i = 0; XL100: X ++i; X unobscured = gprcondeventwait_(&event_type__, t_key__, c_pos__, & X status, 1L); X if ((real) event_type__ != gprnoevent || i > 5000) { X goto L110; X } X goto L100; XL110: X if ((real) event_type__ != gprnoevent) { X strek_interpret_key__(t_key__, 1L); X if (*t_key__ > '0' && *t_key__ <= '6') { X s_rsfi(&io___156); X do_fio(&c__1, (char *)&option, (ftnlen)sizeof(integer)); X e_rsfi(); X t1 = option * (float)5. + (float)10.; X/* Computing 2nd power */ X r__1 = t1; X photon_tr__[3] = r__1 * r__1; X photon_tr__[4] = photon_tr__[3]; X photon_tr__[5] = photon_tr__[3]; X } X } X } X X/* change scanner object keys */ X X if (*key >= '0' && *key <= '9') { X s_rsfi(&io___158); X do_fio(&c__1, (char *)&item, (ftnlen)sizeof(integer)); X e_rsfi(); X if (object[item]) { X scan_ob__ = item; X s_copy(b_message__ + 80, sc_message__ + (index[item] - 1) * X 80, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X } X } X X/* process a nav lock on key */ X X if (*key == 'l' && scan) { X strek_message__(t_message__, &c__3, 80L); X i = 0; XL120: X ++i; X unobscured = gprcondeventwait_(&event_type__, t_key__, c_pos__, & X status, 1L); X if ((real) event_type__ != gprnoevent || i > 5000) { X goto L130; X } X goto L120; XL130: X if ((real) event_type__ != gprnoevent) { X strek_interpret_key__(t_key__, 1L); X if (*t_key__ >= '0' && *t_key__ <= '3') { X s_rsfi(&io___160); X do_fio(&c__1, (char *)&l_object__, (ftnlen)sizeof(integer) X ); X e_rsfi(); X if (object[l_object__] && orange[l_object__] > (float) X 22500.) { X lock_on__ = TRUE_; X s_copy(b_message__ + 80, l_message__ + (index[ X l_object__] - 1) * 80, 80L, 80L); X strek_message__(b_message__, &c__3, 80L); X r_index__ = 10; X nav_c__ = 10; X } X } X } X } X X/* process a nav lock drop key */ X X if (*key == 'o' && lock_on__) { X lock_on__ = FALSE_; X s_copy(b_message__ + 80, "Navigation lock on dropped.", 80L, 27L); X X strek_message__(b_message__, &c__3, 80L); X r_index__ = 9; X } X X/* process a dock key */ X X if (*key == 'd' && orange[0] < (float)900. && dabs(speed) < (float)1.) X { X strek_dock__(d_pct__, &score, user_name__, capt_name__, X nick_name__, ship_name__, &cum_score__, key_file__, & X new_ship__, 10L, 10L, 10L, 30L, 256L); X s_stop("", 0L); X } X X/* process a current score key */ X X if (*key == 'c') { X s_wsfi(&io___161); X do_fio(&c__1, r_message__, 80L); X do_fio(&c__1, ship_name__, 30L); X e_wsfi(); X s_wsfi(&io___162); X do_fio(&c__1, (char *)&ship_k__, (ftnlen)sizeof(integer)); X do_fio(&c__1, (char *)&ship_r__, (ftnlen)sizeof(integer)); X do_fio(&c__1, (char *)&ship_n__, (ftnlen)sizeof(integer)); X do_fio(&c__1, (char *)&dock_n__, (ftnlen)sizeof(integer)); X do_fio(&c__1, (char *)&score, (ftnlen)sizeof(integer)); X do_fio(&c__1, (char *)&cum_score__, (ftnlen)sizeof(integer)); X e_wsfi(); X strek_message__(r_message__, &c__3, 80L); X } X X/* process a clear com window key */ X X if (*key == 'z') { X s_copy(b_message__ + 80, " ", 80L, 1L); X strek_message__(b_message__, &c__3, 80L); X } X X/* process a sleep until key */ X X if (*key == '/') { X strek_message__(sl_message__, &c__3, 80L); XL125: X unobscured = gprcondeventwait_(&event_type__, t_key__, c_pos__, & X status, 1L); X if ((real) event_type__ != gprnoevent) { X goto L135; X } X goto L125; XL135: X s_copy(b_message__ + 80, " ", 80L, 1L); X strek_message__(b_message__, &c__3, 80L); X } X X/* end parsing routines */ X X } X X/* put angles back to normal (between 0 and 360) */ X X if (azm < (float)0.) { X azm += (float)360.; X } X if (azm >= (float)360.) { X azm += (float)-360.; X } X if (angle < (float)0.) { X angle += (float)360.; X } X if (angle >= (float)360.) { X angle += (float)-360.; X } X X/* add engine energy output */ X X energy += (d_pct__[0] + d_pct__[1]) * (float).35; X X/* subtract off energy due to speed and rotation */ X X energy = energy - dabs(speed) / (float)7.5 - rot_cost__[r_index__ - 1]; X X/* subtract energy due to tractors */ X X if (tract_ob__) { X energy = energy - sqrt(trdist) / (float)60. * tr_cost__[tr_object__] X + (float).1; X } X X/* limit energy by battery percent */ X X check = d_pct__[3] * (float)1e3; X if (energy > check) { X energy = check; X } X X/* if out of energy start (or continue) death march */ X X if (energy < (float)0.) { X ++num_times__; X strek_no_energy__(&num_times__, user_name__, capt_name__, nick_name__, X ship_name__, key_file__, &score, &cum_score__, &new_ship__, X 10L, 10L, 10L, 30L, 256L); X } else { X num_times__ = 0; X } X X/* process new coordinates */ X X tempx = xc; X tempy = yc; X tempz = zc; X xc = -(doublereal)sa * cp * speed + xc; X yc = ca * cp * speed + yc; X zc = sp * speed + zc; X for (j = 0; j <= 9; ++j) { X if (object[j]) { X if (j != 0) { X soa[j - 1] = sin(oazm[j]); X coa[j - 1] = cos(oazm[j]); X sop[j - 1] = sin(oangle[j]); X cop[j - 1] = cos(oangle[j]); X obx[j] = -(doublereal)soa[j - 1] * cop[j - 1] * ospeed[j] + X obx[j]; X oby[j] = coa[j - 1] * cop[j - 1] * ospeed[j] + oby[j]; X obz[j] = sop[j - 1] * ospeed[j] + obz[j]; X } X xt[j] = obx[j] - xc; X yt[j] = oby[j] - yc; X zt[j] = obz[j] - zc; X/* Computing 2nd power */ X r__1 = xt[j]; X/* Computing 2nd power */ X r__2 = yt[j]; X/* Computing 2nd power */ X r__3 = zt[j]; X orange[j] = r__1 * r__1 + r__2 * r__2 + r__3 * r__3; X } X/* L150: */ X } X X/* update tractored object */ X X if (tract_ob__ && tract) { X trx = trx - tempx + xc; X try_ = try_ - tempy + yc; X trz = trz - tempz + zc; X j = tr_object__; X obx[j] = trx; X oby[j] = try_; X obz[j] = trz; X oazm[j] = trazm; X oangle[j] = trangle; X xt[j] = obx[j] - xc; X yt[j] = oby[j] - yc; X zt[j] = obz[j] - zc; X/* Computing 2nd power */ X r__1 = xt[j]; X/* Computing 2nd power */ X r__2 = yt[j]; X/* Computing 2nd power */ X r__3 = zt[j]; X orange[j] = r__1 * r__1 + r__2 * r__2 + r__3 * r__3; X trdist = orange[j]; X } X X/* get object to object distances when both exist */ X X for (j = 0; j <= 9; ++j) { X if (object[j]) { X for (i = 1; i <= 3; ++i) { X if (object[i] && i != j) { X/* Computing 2nd power */ X r__1 = obx[i] - obx[j]; X/* Computing 2nd power */ X r__2 = oby[i] - oby[j]; X/* Computing 2nd power */ X r__3 = obz[i] - obz[j]; X distance[i + j * 3 - 1] = r__1 * r__1 + r__2 * r__2 + X r__3 * r__3; X } X/* L170: */ X } X } X/* L160: */ X } X X/* rotate objects into shipocentric coordinates */ X X for (j = 0; j <= 9; ++j) { X if (object[j]) { X rox[j] = xt[j] * ca + yt[j] * sa; X roy[j] = -(doublereal)xt[j] * sa * cp + yt[j] * ca * cp + zt[j] * X sp; X roz[j] = xt[j] * sa * sp - yt[j] * ca * sp + zt[j] * cp; X X/* project shiopcentric coordinates to screen coords */ X X if (roy[j] > (float)1.) { X pro_x__[j] = rox[j] / roy[j] * (float)350. + (float)450.; X pro_y__[j] = (float)400. - roz[j] / roy[j] * (float)350.; X if ((r__1 = pro_x__[j], dabs(r__1)) > (float)3e3) { X pro_x__[j] = (float)1e3; X } X if ((r__1 = pro_y__[j], dabs(r__1)) > (float)3e3) { X pro_y__[j] = (float)1e3; X } X } else { X pro_x__[j] = (float)1e3; X pro_y__[j] = (float)1e3; X if (j == 2) { X center[0] = 1000; X center[1] = 1000; X } X } X X/* fill temporary array for use in scanner windows */ X X pos_store__[j] = pro_x__[j]; X pos_store__[j + 10] = pro_y__[j]; X } X/* L180: */ X } X X/* erase old objects */ X X gprsetdrawvalue_(&c__0, &status); X if (refresh) { X strek_scanner__(rox, roy, roz, object, &c__0); X } X if (plot[0]) { X strek_starbase__(&xc, &yc, &zc, &ca, &cp, &sa, &sp, &c__0); X } X for (j = 1; j <= 9; ++j) { X if (plot[j]) { X switch ((int)j) { X case 1: goto L191; X case 2: goto L192; X case 3: goto L193; X case 4: goto L194; X case 5: goto L195; X case 6: goto L196; X case 7: goto L197; X case 8: goto L198; X case 9: goto L199; X } XL191: X strek_nemian__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], &ca, &sa, X &cp, &sp, &c__0, &soa[j - 1], &coa[j - 1], &sop[j - 1], & X cop[j - 1]); X goto L190; XL192: X if (kling[j - 1]) { X strek_klingon__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], &ca, X &sa, &cp, &sp, &c__0, center, &soa[j - 1], &coa[j - X 1], &sop[j - 1], &cop[j - 1]); X } else { X strek_romulan_1__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], & X ca, &sa, &cp, &sp, &c__0, &soa[j - 1], &coa[j - 1], & X sop[j - 1], &cop[j - 1]); X } X goto L190; XL193: X strek_romulan_2__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], &ca, & X sa, &cp, &sp, &c__0, &soa[j - 1], &coa[j - 1], &sop[j - 1] X , &cop[j - 1]); X goto L190; XL194: X strek_photon_1__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], &ca, & X sa, &cp, &sp, &c__0); X goto L190; XL195: X strek_photon_2__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], &ca, & X sa, &cp, &sp, &c__0); X goto L190; XL196: X strek_photon_3__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], &ca, & X sa, &cp, &sp, &c__0); X goto L190; XL197: X strek_photon_4__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], &ca, & X sa, &cp, &sp, &c__0); X goto L190; XL198: X strek_photon_5__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], &ca, & X sa, &cp, &sp, &c__0); X goto L190; XL199: X strek_photon_6__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[j], &ca, & X sa, &cp, &sp, &c__0); X goto L190; X } XL190: X ; X } X X/* update screen objects */ X X gprsetdrawvalue_(&c__1, &status); X if (refresh) { X strek_scanner__(rox, roy, roz, object, &c__1); X } X refresh = ! refresh; X for (j = 0; j <= 9; ++j) { X plot[j] = FALSE_; X ran_store__[j] = orange[j]; X if (object[j] && orange[j] < (float)4e6) { X if (pro_x__[j] < (float)900. && pro_x__[j] > (float)0.) { X if (pro_y__[j] < (float)800. && pro_y__[j] > (float)0.) { X plot[j] = TRUE_; X if (j == 0) { X strek_starbase__(&xc, &yc, &zc, &ca, &cp, &sa, &sp, & X c__1); X } else { X switch ((int)j) { X case 1: goto L201; X case 2: goto L202; X case 3: goto L203; X case 4: goto L204; X case 5: goto L205; X case 6: goto L206; X case 7: goto L207; X case 8: goto L208; X case 9: goto L209; X } XL201: X strek_nemian__(&xc, &yc, &zc, &obx[j], &oby[j], &obz[ X j], &ca, &sa, &cp, &sp, &c__1, &soa[j - 1], & X coa[j - 1], &sop[j - 1], &cop[j - 1]); X goto L200; XL202: X if (kling[j - 1]) { X strek_klingon__(&xc, &yc, &zc, &obx[j], &oby[j], & X obz[j], &ca, &sa, &cp, &sp, &c__1, center, X &soa[j - 1], &coa[j - 1], &sop[j - 1], & X cop[j - 1]); X } else { X strek_romulan_1__(&xc, &yc, &zc, &obx[j], &oby[j], X &obz[j], &ca, &sa, &cp, &sp, &c__1, &soa[ X j - 1], &coa[j - 1], &sop[j - 1], &cop[j X - 1]); X } X goto L200; XL203: X strek_romulan_2__(&xc, &yc, &zc, &obx[j], &oby[j], & X obz[j], &ca, &sa, &cp, &sp, &c__1, &soa[j - 1] X , &coa[j - 1], &sop[j - 1], &cop[j - 1]); X goto L200; XL204: X strek_photon_1__(&xc, &yc, &zc, &obx[j], &oby[j], & X obz[j], &ca, &sa, &cp, &sp, &c__1); X goto L200; XL205: X strek_photon_2__(&xc, &yc, &zc, &obx[j], &oby[j], & X obz[j], &ca, &sa, &cp, &sp, &c__1); X goto L200; XL206: X strek_photon_3__(&xc, &yc, &zc, &obx[j], &oby[j], & X obz[j], &ca, &sa, &cp, &sp, &c__1); X goto L200; XL207: X strek_photon_4__(&xc, &yc, &zc, &obx[j], &oby[j], & X obz[j], &ca, &sa, &cp, &sp, &c__1); X goto L200; XL208: X strek_photon_5__(&xc, &yc, &zc, &obx[j], &oby[j], & X obz[j], &ca, &sa, &cp, &sp, &c__1); X goto L200; XL209: X strek_photon_6__(&xc, &yc, &zc, &obx[j], &oby[j], & X obz[j], &ca, &sa, &cp, &sp, &c__1); X goto L200; X } X } X } X } XL200: X ; X } X X/* draw center of the screen crosshairs */ X X strek_x_hairs__(); X X/* update panels */ X X if (scan) { X txc = i_nint(&rox[scan_ob__]); X tyc = i_nint(&roy[scan_ob__]); X tzc = i_nint(&roz[scan_ob__]); X r__1 = sqrt(orange[scan_ob__]); X trange = i_nint(&r__1); X } X rate = speed * 2; X i__1 = (integer) energy; X i__2 = (integer) xc; X i__3 = (integer) yc; X i__4 = (integer) zc; X strek_update_panel__(&rate, &i__1, &photons, &phase, &tract_ob__, &i__2, & X i__3, &i__4, &scan, &txc, &tyc, &tzc, &trange, &scan_ob__); X strek_flashers__(object, &lock_on__, &energy, &bitmap_desc__); X X/* evaluate the turn duration, if it is shorter than the */ X/* minimum (which is .06 seconds) then request it again. */ X/* Since this call is slow it makes an ideal timer. */ X X/* L210: */ X timeclock_(timer); X calfloatclock_(timer, &turn); X duration = turn - elapsed; X if (duration > .06) { X elapsed = turn; X/* goto 10 */ X } X timer[0] = 0; X timer[1] = 0; X timer[2] = 15000; X timewait_(&timerelative, timer, &status); X goto L10; X/* goto 210 */ X} /* MAIN__ */ X X#undef u_message__ X#undef s_message__ X#undef ps_message__ X#undef ph_message__ X X X/* Main program alias */ int strek_main__ () { MAIN__ (); } E!O!F! xstrek/strek_main.c exit ===== @work: | Matthias Pfuetzner | @home: ZGDV, Wilhelminenstrasse 7 | 6100 Darmstadt, FRG | Lichtenbergstrasse 73 +49 6151 155-164 or -101 \ <- Tel.nr. -> / +49 6151 75717 pfuetzner@agd.fhg.de pfuetzner@zgdvda.UUCP XBR1YD3U@DDATHD21.BITNET -- Dan Heller ------------------------------------------------ O'Reilly && Associates ZipCode Software Senior Writer President argv@ora.com argv@zipcode.com