Skip to content

Commit 13a5c67

Browse files
committed
trimmed trek portable
1 parent f17fb73 commit 13a5c67

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

examples/trek-portable.bas

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ END_DEAD=1 : END_DATE=2 : END_NOPOWER=3 : END_FAIL=4 : END_WIN=5
1010
' the old THIS_QUADRANT$ and corrupted the grid. Integer codes are exact,
1111
' small, and need no string runtime.
1212
C_EMPTY=0 : C_SHIP=1 : C_GLONKIN=2 : C_BASE=3 : C_PLANET=4
13-
DIM OBJ_LUT$(10)
13+
DIM OBJ_LUT$(5)
1414
OBJ_LUT$(0) = " "
1515
OBJ_LUT$(1) = "E"
1616
OBJ_LUT$(2) = "K"
@@ -23,9 +23,8 @@ OBJ_LUT$(4) = "*"
2323
' 0..63: initialized dict slot (allocated by dictnew)
2424
CMD_DICT=-1
2525

26-
' COURSE_VEC(9,2) = nav keypad deltas; DEVICE_DAMAGE(8) / DEVICE_NAME$(8) = ship systems
27-
dim GALAXY(8,8),COURSE_VEC(9,2),K(3,3),VISITED_GALAXY(8,8),DEVICE_DAMAGE(8),DEVICE_NAME$(8),QUAD(8,8)
28-
InitDeviceNames()
26+
' COURSE_VEC(9,2) = nav keypad deltas; DEVICE_DAMAGE(8) = ship systems (labels via DeviceName$)
27+
dim GALAXY(8,8),COURSE_VEC(9,2),K(3,3),VISITED_GALAXY(8,8),DEVICE_DAMAGE(8),QUAD(8,8)
2928

3029
' ** DISTANCE CALCULATION **
3130
' Uses the Pythagorean theorem to calculate the distance between two points.
@@ -360,15 +359,15 @@ function Nav()
360359
DEVICE_DAMAGE(I)=DEVICE_DAMAGE(I)+D6
361360
if DEVICE_DAMAGE(I)<0 then continue for
362361
if D1=0 then D1=1 : print "\nDAMAGE CONTROL REPORT : "
363-
print DEVICE_NAME$(I);" REPAIR COMPLETED"
362+
print DeviceName$(I);" REPAIR COMPLETED"
364363
next I
365364

366365
if RNDINT(100)<=20 then
367366
J=FNR(1)
368367
if RNDINT(100)<60 then
369-
DEVICE_DAMAGE(J)=DEVICE_DAMAGE(J)-RNDINT(5) : NavWarning("DAMAGED "+DEVICE_NAME$(J))
368+
DEVICE_DAMAGE(J)=DEVICE_DAMAGE(J)-RNDINT(5) : NavWarning("DAMAGED "+DeviceName$(J))
370369
else
371-
DEVICE_DAMAGE(J)=DEVICE_DAMAGE(J)+RNDINT(3) : NavWarning("PARTLY REPAIRED "+DEVICE_NAME$(J))
370+
DEVICE_DAMAGE(J)=DEVICE_DAMAGE(J)+RNDINT(3) : NavWarning("PARTLY REPAIRED "+DeviceName$(J))
372371
end if
373372

374373
end if
@@ -681,7 +680,7 @@ function Damage()
681680
print "\n SYSTEM STATE OF REPAIR"
682681
print " ------------------- -----------------"
683682
for I=1 to 8
684-
print " ";DEVICE_NAME$(I);left$(SPACE_PAD$,20-len(DEVICE_NAME$(I)));
683+
print " ";DeviceName$(I);left$(SPACE_PAD$,20-len(DeviceName$(I)));
685684

686685
if DEVICE_DAMAGE(I)<0 then print "DAMAGED ";DEVICE_DAMAGE(I);
687686
if DEVICE_DAMAGE(I)>=0 then print "OPERATIONAL ";DEVICE_DAMAGE(I);
@@ -715,7 +714,7 @@ function GLONKINsFire()
715714

716715
' DAMAGE CONTROL REPORT
717716
J=FNR(1) : DEVICE_DAMAGE(J)=DEVICE_DAMAGE(J)-RNDINT(3)
718-
print "UPDATE: "+DEVICE_NAME$(J)+" DAMAGED BY THE HIT"
717+
print "UPDATE: "+DeviceName$(J)+" DAMAGED BY THE HIT"
719718
next I
720719
ATAKFLAG=1
721720
return
@@ -1220,18 +1219,18 @@ end function
12201219
function ShowCommands()
12211220
cls()
12221221
print "\n USE THESE COMMANDS:"
1223-
print " NAV - TO SET COURSE"
1224-
print " SRS - FOR SHORT RANGE SCAN"
1225-
print " LRS - FOR LONG RANGE SCAN"
1226-
print " SLS - FOR SHORT & LONG RANGE SCAN"
1227-
print " PHA - TO FIRE LASERS"
1228-
print " TOR - TO FIRE WARHEADS"
1229-
print " SHE - TO RAISE OR LOWER SHIELDS"
1222+
print " NAV - SET COURSE"
1223+
print " SRS - SHORT RANGE SCAN"
1224+
print " LRS - LONG RANGE SCAN"
1225+
print " SLS - SHORT+LONG SCAN"
1226+
print " PHA - FIRE LASERS"
1227+
print " TOR - FIRE WARHEADS"
1228+
print " SHE - SHIELDS"
12301229
print " DAM - DAMAGE REPORT"
1231-
print " COM - QUERY COMPUTER"
1232-
print " KEY - DISPLAY KEY TO SRS ICONS"
1233-
print " HLP - THIS LIST OF COMMANDS"
1234-
print " XXX - TO RESIGN YOUR COMMAND"
1230+
print " COM - COMPUTER"
1231+
print " KEY - SRS ICONS"
1232+
print " HLP - HELP"
1233+
print " XXX - QUIT"
12351234
pause()
12361235
return
12371236
end function
@@ -1265,18 +1264,19 @@ function InitCommandDict()
12651264
end function
12661265

12671266

1268-
function InitDeviceNames()
1269-
DEVICE_NAME$(1)="FTL DRIVE"
1270-
DEVICE_NAME$(2)="SHORT RANGE SENSORS"
1271-
DEVICE_NAME$(3)="LONG RANGE SENSORS"
1272-
DEVICE_NAME$(4)="LASER TARGETING"
1273-
DEVICE_NAME$(5)="WARHEADS"
1274-
DEVICE_NAME$(6)="DAMAGE CONTROL"
1275-
DEVICE_NAME$(7)="SHIELDS"
1276-
DEVICE_NAME$(8)="SHIP COMPUTER"
1277-
return
1267+
function DeviceName$(I)
1268+
select case I
1269+
case 1: return "FTL"
1270+
case 2: return "SRS"
1271+
case 3: return "LRS"
1272+
case 4: return "LASERS"
1273+
case 5: return "WARHEADS"
1274+
case 6: return "DAMAGE"
1275+
case 7: return "SHIELDS"
1276+
case 8: return "COMPUTER"
1277+
end select
1278+
return "?"
12781279
end function
12791280

12801281

12811282

1282-

0 commit comments

Comments
 (0)