-+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+ X IF ((greeblie`5Bcount`5D.x = shot.x) AND (greeblie`5Bcount`5D.y = shot V.y)) THEN BEGIN X (** Without following check, can subtract same shot more than once. V **) X IF NOT (shot.aim = S) THEN `20 X shotsgoing := shotsgoing - 1; X shot.aim := S; X IF greeblie`5Bcount`5D.active THEN activegreeb := activegreeb - 1; X score := score + greebvalue`5Bgreeblie`5Bcount`5D.pic`5D; X Drawchar(shot.y,shot.x,' '); X Showscore(score); X IF (greeblie`5Bcount`5D.pic = topclass) THEN BEGIN X greeblie`5Bcount`5D.x := 0; X greeblie`5Bcount`5D.y := 0; X greeblie`5Bcount`5D.alive := FALSE; X livingreeb := livingreeb - 1; X END X ELSE BEGIN X greeblie`5Bcount`5D.x := startpos`5Bcount`5D.x; X greeblie`5Bcount`5D.y := startpos`5Bcount`5D.y; X greeblie`5Bcount`5D.active := FALSE; X greeblie`5Bcount`5D.pic := greeblie`5Bcount`5D.pic + 1; X Drawchar(greeblie`5Bcount`5D.y,greeblie`5Bcount`5D.x,pic`5Bgreebli Ve`5Bcount`5D.pic`5D); X END; (*** If can be upgraded ***) X END; (** If right greeblie **) `20 X END; X X X BEGIN (** Move Shots **) X Checkshot(shot); X CASE shot.aim OF X U :IF (board`5Bshot.y-1`5D`5Bshot.x`5D IN walls) THEN BEGIN X shot.aim := S; X shotsgoing := shotsgoing - 1; X IF NOT ((shot.x = xpos) AND (shot.y = ypos)) THEN X Drawchar(shot.y,shot.x,space); X END X ELSE X IF ((shot.x = xpos) AND (shot.y = ypos)) THEN BEGIN X shot.y := shot.y - 1; X Drawchar(shot.y,shot.x,'.'); X END X ELSE BEGIN X Drawat(shot.y,shot.x,space+VT100_esc+'`5BD'+VT100_esc+'`5BA.',8 V); X shot.y := shot.y - 1; X END; X D :IF (board`5Bshot.y+1`5D`5Bshot.x`5D IN walls) THEN BEGIN X shot.aim := S; X shotsgoing := shotsgoing - 1; X IF NOT ((shot.y = ypos) AND (shot.x = xpos)) THEN X Drawchar(shot.y,shot.x,space); X END X ELSE X IF ((shot.x = xpos) AND (shot.y = ypos)) THEN BEGIN X shot.y := shot.y + 1; X Drawchar(shot.y,shot.x,'.'); X END X ELSE BEGIN X Drawat(shot.y,shot.x,space+VT100_esc+'`5BD'+VT100_esc+'`5BB.' V,8); X shot.y := shot.y + 1; X END; X L :IF (board`5Bshot.y`5D`5Bshot.x-1`5D IN walls) THEN BEGIN X shot.aim := S; X shotsgoing := shotsgoing - 1; X IF NOT ((shot.y = ypos) AND (shot.x = xpos)) THEN X Drawchar(shot.y,shot.x,space); X END X ELSE X IF ((shot.x = xpos) AND (shot.y = ypos)) THEN BEGIN X shot.x := shot.x - 1; X Drawchar(shot.y,shot.x,'.'); X END X ELSE BEGIN X shot.x := shot.x - 1; X Drawat(shot.y,shot.x,'.'+space,2); X END; X R :IF (board`5Bshot.y`5D`5Bshot.x+1`5D IN walls) THEN BEGIN X shot.aim := S; X shotsgoing := shotsgoing - 1; X IF NOT ((shot.y = ypos) AND (shot.x = xpos)) THEN X Drawchar(shot.y,shot.x,space); X END X ELSE X IF ((shot.x = xpos) AND (shot.y = ypos)) THEN BEGIN X shot.x := shot.x + 1; X Drawchar(shot.y,shot.x,'.'); X END X ELSE BEGIN X Drawat(shot.y,shot.x,space+'.',2); X shot.x := shot.x + 1; X END; X S :; X END; (** case aim **) X X(*** If shot still going ***) X X IF NOT (shot.aim = S) THEN checkshot(shot); X END; X X X PROCEDURE MOVESHOTS; X(*******************) X VAR counter :1..maxshots; X X BEGIN X FOR counter := 1 TO maxshots DO X IF NOT (shots`5Bcounter`5D.aim = S) THEN moveshot(shots`5Bcounter`5D); X END; (** Moveshots **) X X X PROCEDURE FIRE(x,y:INTEGER; aim:directype); X(******************************************) X X VAR shotcount :1..maxshots; X ammoleft :INTEGER; X string1,string2 :v_string; X `20 X BEGIN X IF NOT (shotsgoing = maxshots) THEN BEGIN X shotcount := 1; X WHILE NOT (shots`5Bshotcount`5D.aim = S) DO X shotcount := shotcount + 1; X CASE aim OF X U:ammoleft := ammo.u; X D:ammoleft := ammo.d; X L:ammoleft := ammo.l; X R:ammoleft := ammo.r; X END; (*** Case aim ***) X IF (ammoleft > 0) THEN BEGIN X CASE aim OF X U:BEGIN X ammo.u := ammo.u - 1; X IF (ammo.u = 10) THEN`20 X qio_Write(VT100_esc+'`5B12;7H.') X ELSE`20 X IF (ammo.u = 0) THEN`20 X qio_Write(VT100_esc+'`5B12;7H '); X END; X D:BEGIN X ammo.d := ammo.d - 1; X IF (ammo.d = 10) THEN qio_Write(VT100_esc+'`5B14;7H.') X ELSE IF (ammo.d = 0) THEN qio_Write(VT100_esc+'`5B14;7H '); X END; X L:BEGIN X ammo.l := ammo.l - 1; X IF (ammo.l = 10) THEN qio_Write(VT100_esc+'`5B13;6H.') X ELSE IF (ammo.l = 0) THEN qio_Write(VT100_esc+'`5B13;6H '); X END; X R:BEGIN X ammo.r := ammo.r - 1; X IF (ammo.r = 10) THEN qio_Write(VT100_esc+'`5B13;8H.') X ELSE IF (ammo.r = 0) THEN qio_Write(VT100_esc+'`5B13;8H '); X END; X END; (*** Case aim ***) `20 X shots`5Bshotcount`5D.aim := aim; X shots`5Bshotcount`5D.x := x; X shots`5Bshotcount`5D.y := y; X shotsgoing := shotsgoing + 1; X END; (** If relevant gun has ammo left **) X END; (** If room for more shots. **) X END; (*** fire ***) X X X PROCEDURE RELOAD(VAR Ammolive :BOOLEAN); X (***************************************) X BEGIN X IF Ammolive THEN BEGIN X ammo.u := ammo.u + 20; X ammo.d := ammo.d + 20; X ammo.l := ammo.l + 20; X ammo.r := ammo.r + 20; X DrawAmmo; X Ammolive := FALSE; X END; (* if *) X END; X X X PROCEDURE PAYOUT(VAR Score :INTEGER; VAR Bonuslive :BOOLEAN); X (************************************************************) X BEGIN X IF bonuslive THEN BEGIN X Score := Score + Round_no * 100; X ShowScore(Score); X Bonuslive := FALSE; X END; (* if *) X END; X X X PROCEDURE MOVEPLAYER; X(********************) X X VAR index :1..greeblieno; X X BEGIN X IF NOT(newdirection = direction) THEN X CASE newdirection OF X U :IF NOT (board`5Bypos-1`5D`5Bxpos`5D IN walls) THEN direction := U; X D :IF NOT (board`5Bypos+1`5D`5Bxpos`5D IN walls) THEN direction := D; X L :IF NOT (board`5Bypos`5D`5Bxpos-1`5D IN walls) THEN direction := L; X R :IF NOT (board`5Bypos`5D`5Bxpos+1`5D IN walls) THEN direction := R; X END; (** case newdirection**) X `20 X CASE direction OF X U :IF (board`5Bypos-1`5D`5Bxpos`5D IN walls) THEN direction := S X ELSE BEGIN X Drawat(ypos,xpos,space+VT100_esc+'`5BD'+VT100_esc+'`5BA'+youp Vic,8); X ypos := ypos - 1; X END; X D :IF (board`5Bypos+1`5D`5Bxpos`5D IN walls) THEN direction := S X ELSE BEGIN X Drawat(ypos,xpos,space+VT100_esc+'`5BD'+VT100_esc+'`5BB'+youp Vic,8); X ypos := ypos + 1; X END; X L :IF (board`5Bypos`5D`5Bxpos-1`5D IN walls) THEN direction := S X ELSE BEGIN X xpos := xpos - 1; X Drawat(ypos,xpos,youpic+space,2); X END; X R :IF (board`5Bypos`5D`5Bxpos+1`5D IN walls) THEN direction := S X ELSE BEGIN X Drawat(ypos,xpos,space+youpic,2); X xpos := xpos + 1; X END; X S :; X END; (** case direction**) X X IF (xpos = ammoX) AND (ypos = ammoY) THEN Reload(ammolive) X ELSE IF (xpos = bonusX) AND (ypos = bonusY) THEN Payout(score, bonuslive) V; X X FOR index := 1 TO greeblieno DO X IF (greeblie`5Bindex`5D.alive) X AND (greeblie`5Bindex`5D.x = xpos) AND (greeblie`5Bindex`5D.y = ypos V) THEN X youredead(yourlives); X END; X X X PROCEDURE PLAYERMOVE; X(********************) X VAR inchar :CHAR; X BEGIN X inchar := qio_1_char_now; X CASE inchar OF X CHR(5) :exitordered := TRUE; (* CTRL-E *) X 'i','I','8' :newdirection := U; X 'j','J','4' :newdirection := L; X 'k','K','m','M','2':newdirection := D; X 'l','L','6' :newdirection := R; X 'w','W' :Fire(xpos,ypos,U); X 's','S','x','X' :Fire(xpos,ypos,D); X 'a','A' :Fire(xpos,ypos,L); X 'd','D' :Fire(xpos,ypos,R); X 'r','R' :Initscreen; X OTHERWISE ; X END; (** case **) X Moveplayer; X END; X X X PROCEDURE MOVEGREEBLIES; X(***********************) X X VAR X index :1..greeblieno; X X PROCEDURE MOVEGREEB(VAR greeb: Greeblietype); X (*==========================================*) X X VAR moveno :0..4; X X BEGIN X moveno := 0; X IF ((greeb.y = ypos) AND (greeb.x = xpos)) THEN youredead(yourlives); X IF ((greeb.y > ypos) AND NOT (board`5Bgreeb.y-1`5D`5Bgreeb.x`5D IN walls V)) THEN X moveno := 1; X IF ((greeb.y < ypos) AND NOT (board`5Bgreeb.y+1`5D`5Bgreeb.x`5D IN walls V)) THEN X moveno := 2; X IF ( random(10) <= 5) THEN BEGIN X IF ((greeb.x > xpos) AND NOT (board`5Bgreeb.y`5D`5Bgreeb.x-1`5D IN wal Vls)) THEN X moveno := 3; X IF ((greeb.x < xpos) AND NOT (board`5Bgreeb.y`5D`5Bgreeb.x+1`5D IN wal Vls)) THEN X moveno := 4; X END; (*** 50% chance ***) X IF yourlives > 0 THEN X CASE moveno OF X 1 :BEGIN X Drawat(greeb.y,greeb.x,space+VT100_esc+'`5BD'+VT100_esc+'`5BA'+p Vic`5Bgreeb.pic`5D,8); X greeb.y := greeb.y - 1; X END; X 2 :BEGIN X Drawat(greeb.y,greeb.x,space+VT100_esc+'`5BD'+VT100_esc+'`5BB'+p Vic`5Bgreeb.pic`5D,8); X greeb.y := greeb.y + 1; X END; X 3 :BEGIN X greeb.x := greeb.x - 1; X Drawat(greeb.y,greeb.x,pic`5Bgreeb.pic`5D+space,2); X END; X 4 :BEGIN X Drawat(greeb.y,greeb.x,space+pic`5Bgreeb.pic`5D,2); X greeb.x := greeb.x + 1; X END; X OTHERWISE ; X END; (*** Case moveno ***) X IF ((greeb.y = ypos) AND (greeb.x = xpos)) THEN youredead(yourlives) X ELSE X IF (greeb.y = bonusY) AND (greeb.x = bonusX) THEN bonuslive := FALSE; X END; X X X BEGIN X IF (activegreeb < maxactive) THEN BEGIN X index := random(greeblieno); X IF (greeblie`5Bindex`5D.alive AND NOT(greeblie`5Bindex`5D.active)) THEN V BEGIN X greeblie`5Bindex`5D.active := TRUE; X activegreeb := activegreeb + 1; X END; (*** IF inactive ***) X END; (*** If room for more ***) X X IF (activegreeb > 0) THEN X FOR index := 1 TO greeblieno DO X IF (greeblie`5Bindex`5D.active AND greeblie`5Bindex`5D.alive) THEN X movegreeb(greeblie`5Bindex`5D); X END; X X X(***** Main Program *****) X XBEGIN X InitGame; X REPEAT X InitRound; X Initscreen; X REPEAT X Sleep_start(sleeptime); X Playermove; X IF NOT exitordered THEN BEGIN X Moveshots; X Moveshots; X Movegreeblies; X Sleep_wait; X Move_counter := Move_counter + 1; X IF Ammolive THEN Drawchar(ammoY,ammoX,ammopic); X CASE Move_counter OF X 100 :BEGIN X IF Ammolive THEN BEGIN X DrawChar(ammoY,ammoX,space); X Ammolive := FALSE; X END; (* else *) X END; X 300 :BEGIN X ammoX := xpos; X ammoY := ypos; X END; X 320 :BEGIN X bonusX := xpos; X bonusY := ypos; X END; X 375 :BEGIN X qio_write (VT100_bell); X Drawchar(bonusY,bonusX,bonus); X Bonuslive := TRUE; X END; X 400 :BEGIN X qio_write (VT100_bell); X Ammolive := TRUE; X Move_counter := 0; X END; X OTHERWISE; X END; (** case **) X END; (** If not exitordered **) X UNTIL (yourlives <= 0) OR (livingreeb = 0) OR exitordered; X IF (yourlives > 0) AND NOT exitordered THEN Roundover; X UNTIL (yourlives <= 0) OR exitordered; X qio_write (VT100_graphics_off); X Top_Ten(Score); XEND. $ CALL UNPACK CROSSFIRE.PAS;1 1482957445 $ create 'f' X`1B`5B2J`1B(0`1B`5Bm X`1B`5B1H`1B#6---------lqwqwqwqwqwqwqwqwqwqwqwqwqwqwqk X`1B`5B2H`1B#6 SCORE x x x x x x x x x x x x x x x x X`1B`5B3H`1B#6lqqqqqqqktqj mqj mqj mqj mqj mqj mqj mqu X`1B`5B4H`1B#6x xx x X`1B`5B5H`1B#6mqqqqqqqjtqk lqk lqk lqk lqk lqk lqk lqu X`1B`5B6H`1B#6 x x x x x x x x x x x x x x x x X`1B`5B7H`1B#6 LEVEL tqj mqj mqj mqj mqj mqj mqj mqu X`1B`5B8H`1B#6 lqqk x x X`1B`5B9H`1B#6 x x tqk lqk lqk lqk lqk lqk lqk lqu X`1B`5B10H`1B#6 mqqj x x x x x x x x x x x x x x x x X`1B`5B11H`1B#6 tqj mqj mqj mqj mqj mqj mqj mqu X`1B`5B12H`1B#6 x x X`1B`5B13H`1B#6 O tqk lqk lqk lqk lqk lqk lqk lqu X`1B`5B14H`1B#6l x x x x x x x x x x x x x x x x X`1B`5B15H`1B#6mlk tqj mqj mqj mqj mqj mqj mqj mqu X`1B`5B16H`1B#6 t\lk x x X`1B`5B17H`1B#6 mjlqq tqk lqk lqk lqk lqk lqk lqk lqu X`1B`5B18H`1B#6 mkl x x x x x x x x x x x x x x x x X`1B`5B19H`1B#6qqqqqqjmktqj mqj mqj mqj mqj mqj mqj mqu X`1B`5B20H`1B#6qqFIREqqjx x X`1B`5B21H`1B#6 tqk lqk lqk lqk lqk lqk lqk lqu X`1B`5B22H`1B#6 x x x x x x x x x x x x x x x x X`1B`5B23H`1B#6 mqvqvqvqvqvqvqvqvqvqvqvqvqvqvqj $ CALL UNPACK CROSSFIRE.SCN;1 537288625 $ create 'f' X`1B`5B2J`1B(B`1B`5Bm X`1B`5BH`1B#3 FIRING`1B`5B1;26HMOVING`1B`5B2H`1B#4 FIRING`1B`5B2;26HMOVING`1B +-+-+-+-+-+-+-+- END OF PART 2 +-+-+-+-+-+-+-+-