CONST versionvrsn = "v1.1:0004-indev" 'Update this each build! _TITLE "Electric" DIM SHARED ignore`, ignorethrot`, swidth, sheight, xoffset%, yoffset%, graphsetting, gamepad, screenanchorx%, screenanchory% OPEN "electricsettings.cfg" FOR RANDOM AS #1 LEN = LEN(swidth) GET #1, 1, swidth GET #1, 2, sheight GET #1, 3, fs GET #1, 4, graphsetting GET #1, 9, gamepad GET #1, 19, vol IF swidth > 0 AND sheight > 0 THEN SCREEN _NEWIMAGE(swidth, sheight, 32) ELSE desktop& = _SCREENIMAGE IF desktop& THEN swidth = _WIDTH(desktop&) sheight = _HEIGHT(desktop&) ELSE swidth = 800 sheight = 600 END IF SCREEN _NEWIMAGE(swidth, sheight, 32) IF desktop& THEN _FREEIMAGE desktop& fs = 1 blue = 255 steering = 1 throttle = 3 primary = 1 secondary = 2 team = 1 scrdown = 5 scrup = 4 pick = 3 vol = 0.8 PUT #1, 1, swidth PUT #1, 2, sheight PUT #1, 3, fs PUT #1, 7, blue PUT #1, 10, steering PUT #1, 11, throttle PUT #1, 12, primary PUT #1, 13, secondary PUT #1, 15, team PUT #1, 16, scrdown PUT #1, 17, scrup PUT #1, 18, pick PUT #1, 19, vol END IF CLOSE #1 electricicon& = _LOADIMAGE("ui\electricicon.png") premetal& = _LOADIMAGE("bg\electricplane2.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& IF electricicon& THEN _CLEARCOLOR _RGB(0, 0, 0), electricicon& _ICON electricicon& _FREEIMAGE electricicon& END IF IF fs = 1 THEN _FULLSCREEN quartz& = _LOADFONT("fonts\segment14.otf", sheight / 24, "") cyberbit& = _LOADFONT("fonts\cyberbit.ttf", sheight / 32, "") _PRINTMODE _KEEPBACKGROUND RANDOMIZE TIMER TYPE control number AS SINGLE axis AS SINGLE '1 if axis, 0 if button END TYPE TYPE score points AS INTEGER losses AS INTEGER total AS INTEGER END TYPE TYPE res x AS INTEGER y AS INTEGER caption AS STRING * 64 END TYPE TYPE airplane team AS INTEGER x AS SINGLE y AS SINGLE dir AS SINGLE 'in degrees force AS SINGLE speed AS SINGLE battery AS SINGLE generator AS SINGLE armor AS SINGLE lasthit AS INTEGER credits AS INTEGER yaw AS SINGLE market AS INTEGER markettime AS INTEGER waittime AS INTEGER ammo AS INTEGER ai AS INTEGER maxbatt AS SINGLE maxarm AS SINGLE respawntime AS INTEGER image AS LONG blip AS LONG END TYPE TYPE aug kind AS INTEGER ifon AS INTEGER energy AS SINGLE fuel AS INTEGER 'only used for SRBs ammo AS INTEGER 'only used for stackable mods END TYPE TYPE weapon wep AS INTEGER ifon AS INTEGER firing AS INTEGER remaining AS INTEGER total AS INTEGER ammo AS INTEGER energy AS SINGLE kind AS INTEGER END TYPE TYPE shot x AS SINGLE y AS SINGLE dir AS SINGLE fired AS INTEGER kind AS INTEGER speed AS INTEGER damage AS SINGLE shape AS INTEGER color AS LONG target AS INTEGER 'only used in Homing Plasma charge AS INTEGER 'only used in charging weapons END TYPE TYPE missile x AS SINGLE y AS SINGLE dir AS SINGLE fired AS INTEGER duration AS INTEGER target AS INTEGER kind AS INTEGER END TYPE TYPE debris x AS SINGLE y AS SINGLE life AS INTEGER dir AS SINGLE speed AS SINGLE image AS LONG angle AS SINGLE rotation AS SINGLE END TYPE menumusic& = _SNDOPEN("menu_music.ogg", "sync,vol") _SNDVOL menumusic&, vol IF menumusic& THEN _SNDPLAY menumusic& DO _LIMIT 60 CLS _PUTIMAGE (0, 0), brushedmetal& _FONT quartz& COLOR _RGB(255, 200, 0) center "ELECTRIC", 1 _FONT cyberbit& COLOR _RGB(255, 255, 255) center "Play", 4 center "Options", 5 center "Credits", 6 center "Exit", 7 IF specialstring$ = "funfact" THEN center "Tell me a fun fact!", 8 wot funfact$, 0, 9 * _FONTHEIGHT, swidth END IF _PRINTSTRING (0, sheight - _FONTHEIGHT), versionvrsn IF menu(4) THEN IF _SNDPLAYING(menumusic&) THEN _SNDSTOP menumusic& env IF menumusic& THEN _SNDPLAY menumusic& END IF IF menu(5) THEN options OPEN "electricsettings.cfg" FOR RANDOM AS #1 LEN = LEN(swidth) GET #1, 19, vol CLOSE #1 IF menumusic& THEN _SNDVOL menumusic&, vol premetal& = _LOADIMAGE("bg\electricplane2.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& _FONT 16 quartz& = _LOADFONT("fonts\segment14.otf", sheight / 24, "") cyberbit& = _LOADFONT("fonts\cyberbit.ttf", sheight / 32, "") END IF IF menu(6) THEN credit IF menu(7) THEN CLS _FONT 16 IF quartz& > 0 THEN _FREEFONT (quartz&) IF cyberbit& > 0 THEN _FREEFONT (cyberbit&) IF brushedmetal& < -1 THEN _FREEIMAGE brushedmetal& IF _SNDPLAYING(menumusic&) THEN _SNDSTOP menumusic& _SNDCLOSE menumusic& SYSTEM END IF IF specialstring$ = "funfact" THEN IF menu(8) THEN funfact$ = getfact$ ELSE special$ = INKEY$ IF special$ <> "" THEN specialstring$ = specialstring$ + special$ IF LEN(specialstring$) >= 8 THEN specialstring$ = "" END IF clickonce cursor _DISPLAY LOOP _FREEFONT quartz& SUB credit premetal& = _LOADIMAGE("bg\electricplane2.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& _PUTIMAGE (0, 0), brushedmetal& _FONT 16 quartz& = _LOADFONT("fonts\segment14.otf", sheight / 24, "") cyberbit& = _LOADFONT("fonts\cyberbit.ttf", sheight / 32, "") _FONT quartz& center "CREDITS", 1 _FONT cyberbit& center "Programmer:", 4 center "Patrick 'Cheese-Water' Marsee", 5 center "In-Game Music:", 7 center "N/A", 8 center "Title Music:", 10 center "N/A", 11 center "Other Stuff:", 13 center "QB64 - IDE", 14 center "GIMP - Graphics", 15 center "sfxr - Sound Effects", 16 center "Press any key to return.", 18 _FONT 16 _FREEFONT quartz& _FREEFONT cyberbit& _FREEIMAGE brushedmetal& _DISPLAY SLEEP END SUB SUB center (text$, row%) 'centers text "text$" on row "row" lentext% = _PRINTWIDTH(text$) textheight% = _FONTHEIGHT _PRINTSTRING ((swidth - lentext%) / 2, row% * textheight%), text$ END SUB FUNCTION menu (choice%) 'draws the box around menu item if the mouse is over it, returns -1 if clicked. "choice" is the 16-pixel tall row, starting with 0. DO mousey% = _MOUSEY click% = _MOUSEBUTTON(1) LOOP WHILE _MOUSEINPUT textheight% = _FONTHEIGHT IF textheight% * choice% <= mousey% AND mousey% <= textheight% * choice% + textheight% - 1 THEN LINE (0, textheight% * choice%)-(swidth - 1, textheight% * choice% + textheight% - 1), _RGB(255, 255, 255), B IF ignore` = 0 AND click% THEN menu = -1: ignore` = -1 END IF END FUNCTION SUB wot (text$, startx%, starty%, endx%) 'Makes a small text box between "startx%" and "endx%" (pixels), and starting on "starty%" (pixels) that prints "text$". changetext$ = text$ textlen% = LEN(text$) textwidth% = _PRINTWIDTH(text$) textheight% = _FONTHEIGHT linewidth% = endx% - startx% numline% = 0 DO WHILE textwidth% > linewidth% a% = a% + 1 IF _PRINTWIDTH(LEFT$(changetext$, a%)) > linewidth% THEN FOR k% = a% TO 1 STEP -1 IF MID$(changetext$, k%, 1) = " " THEN textlen% = textlen% - k% _PRINTSTRING (startx%, starty% + textheight% * numline%), LEFT$(changetext$, k%) changetext$ = RIGHT$(changetext$, textlen%) textwidth% = _PRINTWIDTH(changetext$) numline% = numline% + 1 a% = 0 EXIT FOR END IF NEXT END IF LOOP _PRINTSTRING (startx%, starty% + textheight% * numline%), changetext$ END SUB FUNCTION controllerparse$ (part%, num%) numdevice% = _DEVICES IF num% <= numdevice% AND num% >= 1 THEN DIM stringparts$(8) numpart% = 0 devicestring$ = _DEVICE$(num%) FOR a% = 1 TO LEN(devicestring$) b$ = MID$(devicestring$, a%, 1) IF b$ = "[" THEN numpart% = numpart% + 1 IF b$ <> "[" AND b$ <> "]" THEN stringparts$(numpart%) = stringparts$(numpart%) + b$ NEXT controllerparse$ = stringparts$(part%) ELSE controllerparse$ = "ERROR: No such controller!" END IF END FUNCTION SUB clickonce 'Placed at the end of a loop that uses mouse inputs to make sure it doesn't click multiple times while the mousebutton is held. DO click% = _MOUSEBUTTON(1) LOOP WHILE _MOUSEINPUT IF ignore` = -1 AND click% = 0 AND _KEYDOWN(27) = 0 THEN ignore` = 0 END SUB FUNCTION trigger (x1%, y1%, x2%, y2%, x3%, y3%) 'Generates output if coordinates("x3", "y3") fall within ("x1", "y1")-("x2", "y2"). IF x1% <= x3% AND x3% <= x2% AND y1% <= y3% AND y3% <= y2% THEN trigger = -1 END FUNCTION FUNCTION pi 'It's pi. pi = 4 * ATN(1) END FUNCTION FUNCTION rad (degrees) 'Converts degrees to radians. rad = degrees * pi / 180 END FUNCTION FUNCTION deg (radians) 'Converts radians to degrees. deg = radians / pi * 180 END FUNCTION 'FUNCTION mousedir (x, y) 'returns the angle of the mouse relative to coordinates("x", "y"). Not used in this program, but I keep it around in case that changes. 'DO ' mousex = _MOUSEX ' mousey = _MOUSEY 'LOOP WHILE _MOUSEINPUT 'distx = mousex - x 'disty = mousey - y 'angle = ATN(disty / distx) 'IF distx < 0 THEN angle = angle + rad(180) 'mousedir = angle 'END FUNCTION FUNCTION recolor& (image&, old~&, new~&) 'requires an image, the color to change, and the new color. redo& = _COPYIMAGE(image&) 'makes a copy of the image so that it doesn't mess up the original one _SOURCE image& 'set the source as the original image _DEST redo& 'set the destination as the new image FOR x% = 0 TO _WIDTH(image&) - 1 'loop all x values FOR y% = 0 TO _HEIGHT(image&) - 1 'loop all y values IF POINT(x%, y%) = old~& THEN PSET (x%, y%), new~& 'if the color at coordinates ("x", "y") = the old color, then make it the new color on the new image NEXT 'close the y loop NEXT 'close the x loop recolor& = _COPYIMAGE(redo&) 'return the new image _SOURCE 0 'set the source back to the main window _DEST 0 'set the destination back to the main window _FREEIMAGE redo& 'free the new image because we already returned it and this saves memory END FUNCTION FUNCTION colorgreyspectrum& (image&, new~&) 'the secondary livery change& = _COPYIMAGE(image&) _SOURCE image& _DEST change& FOR x% = 0 TO _WIDTH(image&) - 1 FOR y% = 0 TO _HEIGHT(image&) - 1 FOR grey% = 0 TO 127 IF POINT(x%, y%) = _RGB(grey%, grey%, grey%) THEN red% = _RED32(new~&) * (grey% / 127) green% = _GREEN32(new~&) * (grey% / 127) blue% = _BLUE32(new~&) * (grey% / 127) PSET (x%, y%), _RGB(red%, green%, blue%) EXIT FOR END IF NEXT FOR grey% = 128 TO 255 IF POINT(x%, y%) = _RGB(grey%, grey%, grey%) THEN red% = _RED32(new~&) + (255 - _RED32(new~&)) / 128 * (grey% - 127) green% = _GREEN32(new~&) + (255 - _GREEN32(new~&)) / 128 * (grey% - 127) blue% = _BLUE32(new~&) + (255 - _BLUE32(new~&)) / 128 * (grey% - 127) PSET (x%, y%), _RGB(red%, green%, blue%) EXIT FOR END IF NEXT NEXT NEXT _DEST 0 _SOURCE 0 colorgreyspectrum& = _COPYIMAGE(change&) _FREEIMAGE change& END FUNCTION 'FUNCTION darken& (image&, amount) 'Darkens image "image&" by "amount" amount 'redo& = _COPYIMAGE(image&) '_SOURCE image& '_DEST redo& 'FOR x% = 0 TO _WIDTH(image&) - 1 ' FOR y% = 0 TO _HEIGHT(image&) - 1 ' PSET (x%, y%), _RGB(_RED32(POINT(x, y)) / amount, _GREEN32(POINT(x, y)) / amount, _BLUE32(POINT(x, y)) \ amount) ' NEXT 'NEXT 'darken& = _COPYIMAGE(redo&) '_SOURCE 0 '_DEST 0 '_FREEIMAGE redo& 'END FUNCTION FUNCTION shadow& (image&) 'Creates a shadow that looks like "image&", excluding black. redo& = _NEWIMAGE(_WIDTH(image), _HEIGHT(image), 32) _SOURCE image& _DEST redo& FOR x% = 0 TO _WIDTH(image&) - 1 FOR y% = 0 TO _HEIGHT(image&) - 1 oldcolor& = _RGB(_RED32(POINT(x%, y%)), _GREEN32(POINT(x%, y%)), _BLUE32(POINT(x%, y%))) IF oldcolor& = _RGB(0, 0, 0) THEN PSET (x%, y%), _RGB(255, 255, 255) IF oldcolor& <> _RGB(0, 0, 0) THEN PSET (x%, y%), _RGBA(0, 0, 0, 127) NEXT NEXT _CLEARCOLOR _RGB(255, 255, 255), redo& shadow& = _COPYIMAGE(redo&) _SOURCE 0 _DEST 0 _FREEIMAGE redo& END FUNCTION FUNCTION sinecolor% (outer AS INTEGER, inner AS INTEGER, x AS INTEGER, y AS INTEGER, sinx AS INTEGER, siny AS INTEGER) IF outer = inner THEN sinecolor% = outer ELSE IF inner > outer THEN sinecolor% = (SIN(pi / x * sinx) + (SIN(pi / y * siny) - 1)) * (inner - outer) + outer ELSE sinecolor% = (1 - (SIN(pi / x * sinx) + (SIN(pi / y * siny) - 1))) * (outer - inner) + inner END IF END IF END FUNCTION FUNCTION blob& (x%, y%, outer~&, inner~&) 'generates the round sprites for explosions and the like effect& = _NEWIMAGE(x%, y%, 32) _DEST effect& FOR sinx% = 0 TO x% - 1 FOR siny% = 0 TO y% - 1 PSET (sinx%, siny%), _RGBA(sinecolor%(_RED32(outer~&), _RED32(inner~&), x%, y%, sinx%, siny%), sinecolor%(_GREEN32(outer~&), _GREEN32(inner~&), x%, y%, sinx%, siny%), sinecolor%(_BLUE32(outer~&), _BLUE32(inner~&), x%, y%, sinx%, siny%), (SIN(pi / x% * sinx%) + (SIN(pi / y% * siny%) - 1)) * 255) NEXT NEXT blob& = _COPYIMAGE(effect&) _FREEIMAGE effect& END FUNCTION SUB aimer (planes() AS airplane, plane%, numplanes%) 'The aimer mod. angle = planes(plane%).dir FOR a% = 1 TO numplanes% IF planes(a%).team <> planes(plane%).team THEN distx% = planes(a%).x - planes(plane%).x disty% = planes(a%).y - planes(plane%).y totaldist = SQR(distx% ^ 2 + disty% ^ 2) newposx% = totaldist / 16 * planes(a%).speed * COS(planes(a%).dir) newposy% = totaldist / 16 * planes(a%).speed * SIN(planes(a%).dir) distx% = distx% + newposx% disty% = disty% + newposy% CIRCLE (distx% + planes(plane%).x + xoffset%, disty% + planes(plane%).y + yoffset%), 16, _RGB(255, 0, 0) END IF NEXT LINE (planes(plane%).x + xoffset%, planes(plane%).y + yoffset%)-(planes(plane%).x + COS(planes(plane%).dir) * (swidth / 2 - 100) + xoffset%, planes(plane%).y + SIN(planes(plane%).dir) * (swidth / 2 - 100) + yoffset%), _RGB(255, 0, 0) LINE (planes(plane%).x + xoffset%, planes(plane%).y + yoffset%)-(planes(plane%).x + COS(planes(plane%).dir - pi / 6) * (swidth / 2 - 100) + xoffset%, planes(plane%).y + SIN(planes(plane%).dir - pi / 6) * (swidth / 2 - 100) + yoffset%), _RGB(255, 0, 0) LINE (planes(plane%).x + xoffset%, planes(plane%).y + yoffset%)-(planes(plane%).x + COS(planes(plane%).dir + pi / 6) * (swidth / 2 - 100) + xoffset%, planes(plane%).y + SIN(planes(plane%).dir + pi / 6) * (swidth / 2 - 100) + yoffset%), _RGB(255, 0, 0) END SUB SUB converter (plane AS airplane, ifon%) 'The energy ==> armor mod. IF plane.armor < plane.maxarm THEN plane.armor = plane.armor + .01 * plane.maxarm / 10 ELSE ifon% = 0 END IF END SUB SUB srb (plane AS airplane, contrails%(), numcontrail%, booster AS aug) 'The solid rocket booster mod. makecontrail plane.x, plane.y, contrails%(), numcontrail% IF booster.fuel > 0 THEN plane.speed = plane.speed + 0.05 booster.fuel = booster.fuel - 1 ELSE booster.ammo = booster.ammo - 1 IF booster.ammo > 0 THEN booster.fuel = 180 booster.ifon = 0 ELSE DIM blankspace AS aug booster = blankspace END IF END IF END SUB 'SUB scope (plane AS airplane) The defunct scope mod, preserved for old times sake. 'screenanchorx% = plane.x + COS(plane.dir) * (sheight / 2 - 16) 'screenanchory% = plane.y + SIN(plane.dir) * (sheight / 2 - 16) 'xoffset% = -screenanchorx% + swidth / 2 - 100 'yoffset% = -screenanchory% + sheight / 2 'END SUB SUB flare (plane%, planes AS airplane, missiles() AS missile, nummissile%, flr AS aug, flares(), numflare%) 'The flare mod. IF flr.ammo > 0 THEN flr.ammo = flr.ammo - 1 IF numflare% < 125 THEN FOR j = 0 TO 3 numflare% = numflare% + 1 flares(numflare%, 0) = planes.x 'x position flares(numflare%, 1) = planes.y 'y position flares(numflare%, 2) = 0 'time flaredirx = RND * 4 - 2 flarediry = RND * 4 - 2 flares(numflare%, 3) = ATN((SIN(planes.dir) * planes.speed + flarediry) / (COS(planes.dir) * planes.speed + flaredirx)) 'direction IF COS(planes.dir) * planes.speed + flaredirx < 0 THEN flares(numflare%, 3) = flares(numflare%, 3) + pi flares(numflare%, 4) = SQR((SIN(planes.dir) * planes.speed + flarediry) ^ 2 + (COS(planes.dir) * planes.speed + flaredirx) ^ 2) 'speed NEXT END IF IF nummissile% > 0 THEN FOR i = 1 TO nummissile% IF missiles(i).target = plane% THEN chance% = INT(RND * 5) IF chance% <> 0 THEN missiles(i).target = -1 END IF NEXT END IF flr.ifon = 0 IF flr.ammo <= 0 THEN DIM blankspace AS aug flr = blankspace END IF END IF END SUB SUB makeshot (lazers() AS shot, numlazer%, plane AS airplane, fired%, shot%, position%, inmarket AS INTEGER) 'makes the specified "shot" in front of plane "plane", and makes the firing sound. STATIC vulcansound% IF numlazer% < 4999 THEN SELECT CASE position% CASE 1 x = plane.x + COS(plane.dir) * 32 y = plane.y + SIN(plane.dir) * 32 CASE 2 x = plane.x + COS(plane.dir) * 28 + COS(plane.dir + pi / 2) * 4 y = plane.y + SIN(plane.dir) * 28 + SIN(plane.dir + pi / 2) * 4 makeshot lazers(), numlazer%, plane, fired%, shot%, 6, inmarket CASE 3 x = plane.x + COS(plane.dir) * 24 + COS(plane.dir + pi / 2) * 8 y = plane.y + SIN(plane.dir) * 24 + SIN(plane.dir + pi / 2) * 8 makeshot lazers(), numlazer%, plane, fired%, shot%, 7, inmarket CASE 6 x = plane.x + COS(plane.dir) * 28 + COS(plane.dir - pi / 2) * 4 y = plane.y + SIN(plane.dir) * 28 + SIN(plane.dir - pi / 2) * 4 CASE 7 x = plane.x + COS(plane.dir) * 24 + COS(plane.dir - pi / 2) * 8 y = plane.y + SIN(plane.dir) * 24 + SIN(plane.dir - pi / 2) * 8 END SELECT numlazer% = numlazer% + 1 lazers(numlazer%).x = x lazers(numlazer%).y = y lazers(numlazer%).dir = plane.dir lazers(numlazer%).fired = fired% lazers(numlazer%).kind = shot% SELECT CASE shot% CASE 1 IF x + xoffset% > 0 AND x + xoffset% < swidth - 200 AND y + yoffset% > 0 AND y + yoffset% < sheight AND inmarket = 0 THEN zap& = _SNDOPEN("sfx\laser.wav", "sync") IF zap& THEN _SNDPLAY zap& _SNDCLOSE zap& END IF lazers(numlazer%).speed = 16 lazers(numlazer%).damage = .5 lazers(numlazer%).shape = 0 lazers(numlazer%).color = _RGB(255, 0, 0) CASE 2 lazers(numlazer%).dir = lazers(numlazer%).dir + rad(RND * 4 - 2) vulcansound% = vulcansound% + 1 IF x + xoffset% > 0 AND x + xoffset% < swidth - 200 AND y + yoffset% > 0 AND y + yoffset% < sheight AND inmarket = 0 AND vulcansound% >= 5 THEN zap& = _SNDOPEN("sfx\shoot.wav", "sync") IF zap& THEN _SNDPLAY zap& _SNDCLOSE zap& vulcansound% = vulcansound% - 5 END IF lazers(numlazer%).speed = 20 lazers(numlazer%).damage = .05 lazers(numlazer%).shape = 1 lazers(numlazer%).color = _RGB(0, 0, 0) CASE 3 lazers(numlazer%).speed = 16 lazers(numlazer%).damage = .25 lazers(numlazer%).shape = 2 lazers(numlazer%).color = _RGB(0, 100, 200) FOR spread% = 0 TO 1 numlazer% = numlazer% + 1 lazers(numlazer%).x = x lazers(numlazer%).y = y lazers(numlazer%).dir = plane.dir - pi / 6 + spread% * pi / 3 lazers(numlazer%).fired = fired% lazers(numlazer%).kind = 3 lazers(numlazer%).speed = 16 lazers(numlazer%).damage = .25 lazers(numlazer%).shape = 2 lazers(numlazer%).color = _RGB(0, 100, 200) NEXT IF x + xoffset% > 0 AND x + xoffset% < swidth - 200 AND y + yoffset% > 0 AND y + yoffset% < sheight AND inmarket = 0 THEN zap& = _SNDOPEN("sfx\laser.wav", "sync") IF zap& THEN _SNDPLAY zap& _SNDCLOSE zap& END IF CASE 4 lazers(numlazer%).speed = 18 lazers(numlazer%).damage = 1 lazers(numlazer%).shape = 3 lazers(numlazer%).color = _RGB(0, 255, 0) IF x + xoffset% > 0 AND x + xoffset% < swidth - 200 AND y + yoffset% > 0 AND y + yoffset% < sheight AND inmarket = 0 THEN zap& = _SNDOPEN("sfx\plasma.wav", "sync") IF zap& THEN _SNDPLAY zap& _SNDCLOSE zap& END IF CASE 5 lazers(numlazer%).dir = lazers(numlazer%).dir + rad(RND * 4 - 2) IF x + xoffset% > 0 AND x + xoffset% < swidth - 200 AND y + yoffset% > 0 AND y + yoffset% < sheight AND inmarket = 0 THEN zap& = _SNDOPEN("sfx\gauss.wav", "sync") IF zap& THEN _SNDPLAY zap& _SNDCLOSE zap& END IF lazers(numlazer%).speed = 20 lazers(numlazer%).damage = .05 lazers(numlazer%).shape = 1 lazers(numlazer5).color = _RGB(0, 0, 0) FOR spread% = 0 TO 6 numlazer% = numlazer% + 1 lazers(numlazer%).x = x lazers(numlazer%).y = y lazers(numlazer%).dir = plane.dir + rad(RND * 4 - 2) lazers(numlazer%).fired = fired% lazers(numlazer%).kind = 5 lazers(numlazer%).speed = 20 lazers(numlazer%).damage = .05 lazers(numlazer%).shape = 1 lazers(numlazer%).color = _RGB(0, 0, 0) NEXT CASE 6 lazers(numlazer%).dir = lazers(numlazer%).dir + rad(RND * 4 - 2) vulcansound% = vulcansound% + 1 IF x + xoffset% > 0 AND x + xoffset% < swidth - 200 AND y + yoffset% > 0 AND y + yoffset% < sheight AND inmarket = 0 AND vulcansound% >= 5 THEN zap& = _SNDOPEN("sfx\shoot.wav", "sync") IF zap& THEN _SNDPLAY zap& _SNDCLOSE zap& vulcansound% = vulcansound% - 5 END IF lazers(numlazer%).speed = 20 lazers(numlazer%).damage = .1 lazers(numlazer%).shape = 1 lazers(numlazer%).color = _RGB(0, 0, 0) plane.speed = plane.speed - .01 END SELECT END IF END SUB SUB makecharge (lazers() AS shot, numlazer%, plane%, planes() AS airplane, shot%, power, position%, numplanes%) 'basically makeshot for charging weapons IF numlazer% < 4999 THEN SELECT CASE position% CASE 1 x = planes(plane%).x + COS(planes(plane%).dir) * 16 y = planes(plane%).y + SIN(planes(plane%).dir) * 16 CASE 2 x = planes(plane%).x + COS(planes(plane%).dir) * 12 + COS(planes(plane%).dir + pi / 2) * 4 y = planes(plane%).y + SIN(planes(plane%).dir) * 12 + SIN(planes(plane%).dir + pi / 2) * 4 makecharge lazers(), numlazer%, plane%, planes(), shot%, power, 6, numplanes% CASE 3 x = planes(plane%).x + COS(planes(plane%).dir) * 8 + COS(planes(plane%).dir + pi / 2) * 8 y = planes(plane%).y + SIN(planes(plane%).dir) * 8 + SIN(planes(plane%).dir + pi / 2) * 8 makecharge lazers(), numlazer%, plane%, planes(), shot%, power, 7, numplanes% CASE 6 x = planes(plane%).x + COS(planes(plane%).dir) * 12 + COS(planes(plane%).dir - pi / 2) * 4 y = planes(plane%).y + SIN(planes(plane%).dir) * 12 + SIN(planes(plane%).dir - pi / 2) * 4 CASE 7 x = planes(plane%).x + COS(planes(plane%).dir) * 8 + COS(planes(plane%).dir - pi / 2) * 8 y = planes(plane%).y + SIN(planes(plane%).dir) * 8 + SIN(planes(plane%).dir - pi / 2) * 8 END SELECT numlazer% = numlazer% + 1 lazers(numlazer%).x = x lazers(numlazer%).y = y lazers(numlazer%).dir = planes(plane%).dir lazers(numlazer%).fired = plane% lazers(numlazer%).kind = shot% lazers(numlazer%).charge = power * 5 SELECT CASE shot% CASE 7 lazers(numlazer%).speed = 12 lazers(numlazer%).shape = 3 lazers(numlazer%).color = _RGB(0, 255, 0) lazers(numlazer%).target = -1 IF x + xoffset% > 0 AND x + xoffset% < swidth - 200 AND y + yoffset% > 0 AND y + yoffset% < sheight THEN zap& = _SNDOPEN("sfx\bolt.wav", "sync") IF zap& THEN _SNDPLAY zap& _SNDCLOSE zap& END IF smallangle = pi / 4 FOR k% = 0 TO numplanes% IF planes(k%).team <> planes(plane%).team OR planes(k%).armor <> 0 THEN distx% = planes(k%).x - lazers(numlazer%).x disty% = planes(k%).y - lazers(numlazer%).y dist = SQR(distx% ^ 2 + disty% ^ 2) angle2 = ATN(disty% / distx%) IF distx% < 0 THEN angle2 = angle2 + pi IF angle2 < 0 THEN angle2 = angle2 + 2 * pi angledist = ABS(lazers(numlazer%).dir - angle2) IF angledist <= pi / 6 AND dist > 48 AND angledist < smallangle THEN smallangle = angledist lazers(numlazer%).target = k% END IF END IF NEXT CASE 8 lazers(numlazer%).speed = 16 lazers(numlazer%).shape = 4 lazers(numlazer%).color = _RGB(127, 0, 255) IF x + xoffset% > 0 AND x + xoffset% < swidth - 200 AND y + yoffset% > 0 AND y + yoffset% < sheight THEN zap& = _SNDOPEN("sfx\bolt.wav", "sync") IF zap& THEN _SNDPLAY zap& _SNDCLOSE zap& END IF END SELECT END IF END SUB SUB makemissile (missiles() AS missile, nummissile%, plane%, planes() AS airplane, shot%, numplanes%) 'makes the specified missile "shot" in front of plane "plane", makes the firing sound, and chooses its target. IF nummissile% < 49 THEN nummissile% = nummissile% + 1 missiles(nummissile%).x = planes(plane%).x missiles(nummissile%).y = planes(plane%).y IF missiles(nummissile%).x + xoffset% > 0 AND missiles(nummissile%).x + xoffset% < swidth - 200 AND missiles(nummissile%).y + yoffset% > 0 AND missiles(nummissile%).y + yoffset% < sheight THEN whoosh& = _SNDOPEN("sfx\missile.wav", "sync") IF whoosh& THEN _SNDPLAY whoosh& _SNDCLOSE whoosh& END IF missiles(nummissile%).dir = planes(plane%).dir missiles(nummissile%).fired = plane% missiles(nummissile%).duration = 0 missiles(nummissile%).target = -1 missiles(nummissile%).kind = shot% smallangle = pi / 4 FOR k% = 0 TO numplanes% IF planes(k%).team <> planes(plane%).team OR planes(k%).armor > 0 THEN distx% = planes(k%).x - missiles(nummissile%).x disty% = planes(k%).y - missiles(nummissile%).y dist = SQR(distx% ^ 2 + disty% ^ 2) angle2 = ATN(disty% / distx%) ' In this case, there is no angle1. angle2 is the angle between the missile and its target. IF distx% < 0 THEN angle2 = angle2 + pi IF angle2 < 0 AND missiles(nummissile%).dir >= pi / 6 AND missiles(nummissile%).dir <= 11 * pi / 6 THEN 'When I refer to "fixing" an angle, I mean to add 2 * pi if it's negative. angle2 = angle2 + 2 * pi ' only fix angle2 if the missile isn't pinting east. ELSE IF missiles(nummissile%).dir > 11 * pi / 6 THEN missiles(nummissile%).dir = missiles(nummissile%).dir - 2 * pi 'if it is pointing east, un-fix the missile's angle instead. END IF angledist = ABS(missiles(nummissile%).dir - angle2) IF angledist <= pi / 6 AND dist > 48 AND angledist < smallangle THEN smallangle = angledist missiles(nummissile%).target = k% END IF END IF NEXT END IF END SUB SUB lazer (lazers() AS shot, planes() AS airplane, points() AS score, numlazer%, explosions%(), numexplosion%, numplanes%, difficulty, plas&, spread&, pulse&, mods() AS aug, debriss() AS debris, numdebris%) 'Handles all of the bullets and their collisions. Note: When I discovered that it should be spelled "laser," it was already too late. It would have taken hours to change all the references to "lazer," "makelazer," "numlazer," and "lazers()." IF numlazer% > 0 THEN FOR k% = 1 TO numlazer% lazers(k%).x = lazers(k%).x + COS(lazers(k%).dir) * lazers(k%).speed lazers(k%).y = lazers(k%).y + SIN(lazers(k%).dir) * lazers(k%).speed SELECT CASE lazers(k%).shape CASE 0: LINE (lazers(k%).x + xoffset%, lazers(k%).y + yoffset%)-(lazers(k%).x - COS(lazers(k%).dir) * 16 + xoffset%, lazers(k%).y - SIN(lazers(k%).dir) * 16 + yoffset%), lazers(k%).color CASE 1: LINE (lazers(k%).x + xoffset%, lazers(k%).y + yoffset%)-(lazers(k%).x + xoffset% + 1, lazers(k%).y + yoffset% + 1), lazers(k%).color, BF CASE 2: _PUTIMAGE (lazers(k%).x - 4 + xoffset%, lazers(k%).y - 4 + yoffset%), spread& CASE 3: _PUTIMAGE (lazers(k%).x - 4 + xoffset%, lazers(k%).y - 4 + yoffset%), plas& CASE 4: _PUTIMAGE (lazers(k%).x - 4 + xoffset%, lazers(k%).y - 4 + yoffset%), pulse& END SELECT FOR p% = 0 TO numplanes% IF trigger(planes(p%).x - 16, planes(p%).y - 16, planes(p%).x + 15, planes(p%).y + 15, lazers(k%).x, lazers(k%).y) AND planes(p%).armor > 0 AND p% <> lazers(k%).fired THEN IF lazers(k%).x + xoffset% > 0 AND lazers(k%).x + xoffset% < swidth - 200 AND lazers(k%).y + yoffset% > 0 AND lazers(k%).y + yoffset% < sheight THEN hit& = _SNDOPEN("sfx\hit.wav", "sync") IF hit& <> 0 THEN _SNDPLAY hit& _SNDCLOSE hit& END IF IF planes(p%).team <> planes(lazers(k%).fired).team THEN planes(p%).lasthit = lazers(k%).fired ELSE IF planes(p%).team = 0 AND lazers(k%).fired = 0 THEN PRINT "Hey, Einstein! I'm on your side!" END IF planes(p%).armor = planes(p%).armor - lazers(k%).damage makeexplosion lazers(k%).x, lazers(k%).y, explosions%(), numexplosion%, 15, 0 IF lazers(k%).kind <> 8 THEN removeshot lazers(), k%, numlazer% IF lazers(k%).kind = 8 THEN lazers(k%).charge = lazers(k%).charge * 2 crash planes(), explosions%(), points(), numexplosion%, numplanes%, difficulty, mods(), debriss(), numdebris% END IF NEXT IF lazers(k%).x < 0 OR lazers(k%).x > 4095 OR lazers(k%).y < 0 OR lazers(k%).y > 4095 THEN removeshot lazers(), k%, numlazer% NEXT END IF END SUB SUB charge (lazers() AS shot, planes() AS airplane, numlazer%) 'Like lazer, but for charged shots IF numlazer% > 0 THEN FOR k% = 1 TO numlazer% IF lazers(k%).kind = 7 OR lazers(k%).kind = 8 THEN lazers(k%).damage = lazers(k%).charge / 100 IF lazers(k%).kind = 7 THEN IF lazers(k%).target <> -1 THEN angle = lazers(k%).dir distx% = planes(lazers(k%).target).x - lazers(k%).x disty% = planes(lazers(k%).target).y - lazers(k%).y angle2 = ATN(disty% / distx%) IF distx% < 0 THEN angle2 = angle2 + pi IF angle2 < 0 THEN angle2 = angle2 + 2 * pi IF ABS(angle - angle2) > rad(3) THEN IF angle >= pi THEN IF angle - angle2 < pi AND angle - angle2 > 0 THEN lazers(k%).dir = lazers(k%).dir - rad(1.5) ELSE lazers(k%).dir = lazers(k%).dir + rad(1.5) END IF IF angle < pi THEN IF angle2 - angle < pi AND angle2 - angle > 0 THEN lazers(k%).dir = lazers(k%).dir + rad(1.5) ELSE lazers(k%).dir = lazers(k%).dir - rad(1.5) END IF END IF IF lazers(k%).dir >= 2 * pi THEN lazers(k%).dir = 0 IF lazers(k%).dir < 0 THEN lazers(k%).dir = lazers(k%).dir + 2 * pi END IF END IF IF lazers(k%).charge <= 0 THEN removeshot lazers(), k%, numlazer% lazers(k%).charge = lazers(k%).charge - 1 END IF NEXT END IF END SUB SUB removeshot (lazers() AS shot, k%, numlazer%) 'removes bullets after they hit stuff FOR a% = k% TO numlazer% lazers(a%) = lazers(a% + 1) NEXT numlazer% = numlazer% - 1 END SUB SUB missile (missiles() AS missile, planes() AS airplane, points() AS score, nummissile%, contrails%(), numcontrail%, image&, explosions%(), numexplosion%, numplanes%, difficulty, mods() AS aug, debriss() AS debris, numdebris%) 'Handles missiles and their collisions. IF nummissile% > 0 THEN FOR k% = 1 TO nummissile% IF graphsetting = 1 THEN makecontrail missiles(k%).x, missiles(k%).y, contrails%(), numcontrail% missiles(k%).x = missiles(k%).x + COS(missiles(k%).dir) * 16 missiles(k%).y = missiles(k%).y + SIN(missiles(k%).dir) * 16 makecontrail missiles(k%).x, missiles(k%).y, contrails%(), numcontrail% IF missiles(k%).target <> -1 THEN angle = missiles(k%).dir distx% = planes(missiles(k%).target).x - missiles(k%).x disty% = planes(missiles(k%).target).y - missiles(k%).y IF missiles(k%).kind = 10 THEN totaldist = SQR(distx% ^ 2 + disty% ^ 2) newposx% = totaldist / 16 * planes(missiles(k%).target).speed * COS(planes(missiles(k%).target).dir) newposy% = totaldist / 16 * planes(missiles(k%).target).speed * SIN(planes(missiles(k%).target).dir) distx% = distx% + newposx% disty% = disty% + newposy% END IF CIRCLE (distx% + missiles(k%).x + xoffset%, disty% + missiles(k%).y + yoffset%), 16, _RGB(255, 0, 0) IF missiles(k%).target = 0 THEN _PRINTSTRING (swidth / 2 - 100 - _PRINTWIDTH("MISSILE INCOMING!"), sheight / 2 - 32), "MISSILE INCOMING!" angle2 = ATN(disty% / distx%) IF distx% < 0 THEN angle2 = angle2 + pi IF angle2 < 0 THEN angle2 = angle2 + 2 * pi IF missiles(k%).kind = 11 THEN turn = .5 ELSE turn = 1.5 IF ABS(angle - angle2) > rad(3) THEN IF angle >= pi THEN IF angle - angle2 < pi AND angle - angle2 > 0 THEN missiles(k%).dir = missiles(k%).dir - rad(turn) ELSE missiles(k%).dir = missiles(k%).dir + rad(turn) END IF IF angle < pi THEN IF angle2 - angle < pi AND angle2 - angle > 0 THEN missiles(k%).dir = missiles(k%).dir + rad(turn) ELSE missiles(k%).dir = missiles(k%).dir - rad(turn) END IF END IF IF missiles(k%).dir >= 2 * pi THEN missiles(k%).dir = 0 IF missiles(k%).dir < 0 THEN missiles(k%).dir = missiles(k%).dir + 2 * pi END IF rotator missiles(k%).x + xoffset%, missiles(k%).y + yoffset%, missiles(k%).dir, image&, 0, 0, 15, 15, 16 IF missiles(k%).kind <> 11 THEN FOR p% = 0 TO numplanes% IF trigger(planes(p%).x - 16, planes(p%).y - 16, planes(p%).x + 15, planes(p%).y + 15, missiles(k%).x, missiles(k%).y) AND planes(p%).armor > 0 AND p% <> missiles(k%).fired THEN IF missiles(k%).x + xoffset% > 0 AND missiles(k%).x + xoffset% < swidth - 200 AND missiles(k%).y + yoffset% > 0 AND missiles(k%).y + yoffset% < sheight THEN hit& = _SNDOPEN("sfx\missilehit.wav", "sync") IF hit& <> 0 THEN _SNDPLAY hit& _SNDCLOSE hit& END IF IF planes(p%).team <> planes(missiles(k%).fired).team THEN planes(p%).lasthit = missiles(k%).fired ELSE IF planes(p%).team = 0 AND missiles(k%).fired = 0 THEN PRINT "Hey, Einstein! I'm on your side!" END IF planes(p%).armor = planes(p%).armor - 5 makeexplosion missiles(k%).x, missiles(k%).y, explosions%(), numexplosion%, 30, 0 removemissile missiles(), k%, nummissile% crash planes(), explosions%(), points(), numexplosion%, numplanes%, difficulty, mods(), debriss(), numdebris% END IF NEXT ELSE IF missiles(k%).target <> -1 THEN angle = angle + 180 angle2 = angle2 + 180 IF ABS(angle - angle2) >= pi / 2 THEN FOR p% = 0 TO numplanes% distx% = planes(p%).x - missiles(k%).x disty% = planes(p%).y - missiles(k%).y totaldist = SQR(distx% ^ 2 + disty% ^ 2) IF totaldist < 300 THEN hit& = _SNDOPEN("cruze.wav", "sync") IF hit& <> 0 THEN _SNDPLAY hit& _SNDCLOSE hit& planes(p%).armor = planes(p%).armor - (30 - totaldist / 10) IF planes(p%).team <> planes(missiles(k%).fired).team THEN planes(p%).lasthit = missiles(k%).fired ELSE IF planes(p%).team = 0 AND missiles(k%).fired = 0 THEN PRINT "Hey, Einstein! I'm on your side!" END IF END IF NEXT makeexplosion missiles(k%).x, missiles(k%).y, explosions%(), numexplosion%, 120, 1 removemissile missiles(), k%, nummissile% crash planes(), explosions%(), points(), numexplosion%, numplanes%, difficulty, mods(), debriss(), numdebris% END IF END IF END IF missiles(k%).duration = missiles(k%).duration + 1 IF missiles(k%).x < 0 OR missiles(k%).x > 4095 OR missiles(k%).y < 0 OR missiles(k%).y > 4095 THEN removemissile missiles(), k%, nummissile% IF missiles(k%).kind = 9 THEN IF missiles(k%).duration >= 180 THEN removemissile missiles(), k%, nummissile% IF missiles(k%).kind = 10 THEN IF missiles(k%).duration >= 360 THEN removemissile missiles(), k%, nummissile% IF missiles(k%).kind = 11 THEN IF missiles(k%).duration >= 540 THEN removemissile missiles(), k%, nummissile% NEXT END IF END SUB SUB removemissile (missiles() AS missile, k%, nummissile%) 'Removes missiles. FOR a% = k% TO nummissile% missiles(a%) = missiles(a% + 1) NEXT missiles(nummissile%).target = -1 nummissile% = nummissile% - 1 END SUB SUB makecontrail (x%, y%, contrails%(), numcontrail%) 'Makes smoke puffs. IF numcontrail% < 4999 THEN numcontrail% = numcontrail% + 1 contrails%(numcontrail%, 0) = x% contrails%(numcontrail%, 1) = y% contrails%(numcontrail%, 2) = 0 END IF END SUB SUB makeexplosion (x%, y%, explosions%(), numexplosion%, duration%, kind%) 'Makes the explosions. IF numexplosion% < 199 THEN numexplosion% = numexplosion% + 1 explosions%(numexplosion%, 0) = x% ' x position explosions%(numexplosion%, 1) = y% ' y position explosions%(numexplosion%, 2) = 0 ' time in existence explosions%(numexplosion%, 3) = duration% ' end of life explosions%(numexplosion%, 4) = kind% ' kind of explostion END IF END SUB SUB maketrail (x%, y%, trails%(), numtrail%, wing%) IF numtrail% < 999 THEN numtrail% = numtrail% + 1 trails%(numtrail%, 0) = x% ' x position trails%(numtrail%, 1) = y% ' y position trails%(numtrail%, 2) = 0 ' time in existence trails%(numtrail%, 3) = wing% ' wing to follow END IF END SUB SUB makedebris (plane AS airplane, debriss() AS debris, numdebris%) IF numdebris% <= 252 THEN FOR k = 0 TO 3 numdebris% = numdebris% + 1 debriss(numdebris%).x = plane.x debriss(numdebris%).y = plane.y debriss(numdebris%).life = 0 'time in existence debrisdirx = RND * 4 - 2 debrisdiry = RND * 4 - 2 debriss(numdebris%).dir = ATN((SIN(plane.dir) * plane.speed + debrisdiry) / (COS(plane.dir) * plane.speed + debrisdirx)) 'direction IF COS(plane.dir) * plane.speed + debrisdirx < 0 THEN debriss(numdebris%).dir = debriss(numdebris%).dir + pi debriss(numdebris%).speed = SQR((SIN(plane.dir) * plane.speed + debrisdiry) ^ 2 + (COS(plane.dir) * plane.speed + debrisdirx) ^ 2) 'speed debriss(numdebris%).image = _NEWIMAGE(_HEIGHT(plane.image) / 2, _HEIGHT(plane.image) / 2, 32) 'use height for both since we want a square SELECT CASE k 'remember that the image of the plane that we want is a square in the center of plane.image, not the whole thing CASE 0: _PUTIMAGE , plane.image, debriss(numdebris%).image, (64, 0)-STEP(15, 15) CASE 1: _PUTIMAGE , plane.image, debriss(numdebris%).image, (64 + _HEIGHT(plane.image) / 2, 0)-STEP(15, 15) CASE 2: _PUTIMAGE , plane.image, debriss(numdebris%).image, (64, _HEIGHT(plane.image) / 2)-STEP(15, 15) CASE 3: _PUTIMAGE , plane.image, debriss(numdebris%).image, (64 + _HEIGHT(plane.image) / 2, _HEIGHT(plane.image) / 2)-STEP(15, 15) END SELECT debriss(numdebris%).angle = debriss(numdebriss%).dir debriss(numdebris%).rotation = RND * 4 - 2 NEXT END IF END SUB SUB contrail (contrails%(), numcontrail%, contraileffect&) 'makes the smoke puffs wiggle, and removes them when it's time. IF numcontrail% > 0 THEN FOR k% = 1 TO numcontrail% contrails%(k%, 0) = contrails%(k%, 0) + INT(RND * 3) - 1 contrails%(k%, 1) = contrails%(k%, 1) + INT(RND * 3) - 1 contrails%(k%, 2) = contrails%(k%, 2) + 1 IF graphsetting = 0 AND contrails%(k%, 2) >= 60 THEN remove contrails%(), k%, numcontrail%, 2 IF contrails%(k%, 2) >= 180 THEN remove contrails%(), k%, numcontrail%, 2 IF contrails%(k%, 0) + xoffset% > 0 AND contrails%(k%, 0) + xoffset% < swidth - 200 AND contrails%(k%, 1) + yoffset% > 0 AND contrails%(k%, 1) + yoffset% < sheight THEN _PUTIMAGE (contrails%(k%, 0) + xoffset% - 8, contrails%(k%, 1) + yoffset% - 8), contraileffect& END IF NEXT END IF END SUB SUB explosion (explosions%(), numexplosion%, explosioneffect&) 'Makes the explosions animate, and removes them when it's time. IF numexplosion% > 0 THEN FOR k% = 1 TO numexplosion% IF explosions%(k%, 0) + xoffset% > 0 AND explosions%(k%, 0) + xoffset% < swidth - 200 AND explosions%(k%, 1) + yoffset% > 0 AND explosions%(k%, 1) + yoffset% < sheight THEN IF explosions%(k%, 4) = 0 THEN _PUTIMAGE (explosions%(k%, 0) + xoffset% - explosions%(k%, 2), explosions%(k%, 1) + yoffset% - explosions%(k%, 2))-(explosions%(k%, 0) + xoffset% + explosions%(k%, 2) - 1, explosions%(k%, 1) + yoffset% + explosions%(k%, 2) - 1), explosioneffect& END IF IF explosions%(k%, 4) = 1 THEN LINE (0, 0)-(swidth - 201, sheight - 1), _RGBA(0, 0, 0, 127 - (explosions%(k%, 2) / explosions%(k%, 3) * 127)), BF IF explosions%(k%, 2) <= 30 THEN LINE (0, 0)-(swidth - 201, sheight - 1), _RGBA(255, 255, 255, 255 - (explosions%(k%, 2) / 30 * 255)), BF END IF END IF explosions%(k%, 2) = explosions%(k%, 2) + 1 IF explosions%(k%, 2) >= explosions%(k%, 3) THEN remove explosions%(), k%, numexplosion%, 4 NEXT END IF END SUB SUB trail (trails%(), numtrail%, numplanes%) DIM traillinks(32, 32) AS INTEGER IF numtrail% > 0 THEN FOR p% = 0 TO numplanes% * 2 + 1 '# of wings numlink% = 0 FOR k% = 1 TO numtrail% IF trails%(k%, 3) = p% THEN traillinks(p%, numlink%) = k% numlink% = numlink% + 1 IF numlink% >= 30 THEN numlink% = 30 END IF NEXT IF numlink% > 0 THEN FOR l% = 1 TO numlink% - 1 IF trails%(traillinks(p%, l%), 0) + xoffset% > 0 AND trails%(traillinks(p%, l%), 0) + xoffset% < swidth - 200 AND trails%(traillinks(p%, l%), 1) + yoffset% > 0 AND trails%(traillinks(p%, l%), 1) + yoffset% < sheight THEN IF trails%(traillinks(p%, l%), 2) >= trails%(traillinks(p%, l% - 1), 2) - 2 THEN LINE (trails%(traillinks(p%, l%), 0) + xoffset%, trails%(traillinks(p%, l%), 1) + yoffset%)-(trails%(traillinks(p%, l% - 1), 0) + xoffset%, trails%(traillinks(p%, l% - 1), 1) + yoffset%), _RGB(191, 191, 191) END IF NEXT END IF NEXT FOR a% = 1 TO numtrail% trails%(a%, 2) = trails%(a%, 2) + 1 IF trails%(a%, 2) >= 30 THEN remove trails%(), a%, numtrail%, 3 NEXT END IF END SUB SUB flareeffect (flares(), numflare%, contrails%(), numcontrail%, flareimage&) IF numflare% > 0 THEN FOR i = 1 TO numflare% flares(i, 0) = flares(i, 0) + COS(flares(i, 3)) * flares(i, 4) flares(i, 1) = flares(i, 1) + SIN(flares(i, 3)) * flares(i, 4) _PUTIMAGE (flares(i, 0) - 4 + xoffset%, flares(i, 1) - 4 + yoffset%), flareimage& makecontrail flares(i, 0), flares(i, 1), contrails%(), numcontrail% flares(i, 2) = flares(i, 2) + 1 IF flares(i, 2) >= 60 THEN FOR b = i TO numflare% FOR a = 0 TO 4 flares(b, a) = flares(b + 1, a) NEXT NEXT numflare% = numflare% - 1 END IF NEXT END IF END SUB SUB debriseffect (debriss() AS debris, numdebris%, explosions%(), numexplosion%) IF numdebris% > 0 THEN FOR i = 1 TO numdebris% debriss(i).x = debriss(i).x + COS(debriss(i).dir) * debriss(i).speed debriss(i).y = debriss(i).y + SIN(debriss(i).dir) * debriss(i).speed debriss(i).angle = debriss(i).angle + (debriss(i).rotation / 60) rotator debriss(i).x + xoffset%, debriss(i).y + yoffset%, debriss(i).angle, debriss(i).image, 0, 0, 15, 15, 16 IF debriss(i).life / 5 = debriss(i).life \ 5 THEN makeexplosion debriss(i).x, debriss(i).y, explosions%(), numexplosion%, 15, 0 IF debriss(i).life >= 60 THEN FOR a = i TO numdebris% debriss(i) = debriss(i + 1) NEXT numdebris% = numdebris% - 1 END IF debriss(i).life = debriss(i).life + 1 NEXT END IF END SUB SUB remove (object%(), num%, maxnum%, dims%) 'removes things FOR b% = 0 TO dims% FOR a% = num% TO maxnum% object%(a%, b%) = object%(a% + 1, b%) NEXT NEXT maxnum% = maxnum% - 1 END SUB SUB cursor 'makes the little circle mouse pointer. DO mousex% = _MOUSEX mousey% = _MOUSEY LOOP WHILE _MOUSEINPUT CIRCLE (mousex%, mousey%), 2, _RGB(255, 255, 255) END SUB SUB env 'the main body of the game. CLS center "Loading...", 4 _DISPLAY DIM topo%(15, 15) DIM ground&(43) ground&(0) = _LOADIMAGE("bg\grass03.png") ground&(1) = _LOADIMAGE("bg\woods02.png") 'ground&(2) = _LOADIMAGE("bg\water.png") ground&(3) = _LOADIMAGE("bg\blendgrasswoodsbottomright.png") ground&(4) = _LOADIMAGE("bg\blendgrasswoodsbottomleft.png") ground&(5) = _LOADIMAGE("bg\blendgrasswoodstopright.png") ground&(6) = _LOADIMAGE("bg\blendgrasswoodstopleft.png") ground&(7) = _LOADIMAGE("bg\blendgrasswoodsbottom.png") ground&(8) = _LOADIMAGE("bg\blendgrasswoodsleft.png") ground&(9) = _LOADIMAGE("bg\blendgrasswoodstop.png") ground&(10) = _LOADIMAGE("bg\blendgrasswoodsright.png") ground&(11) = _LOADIMAGE("bg\blendgrasswoodstopright2.png") ground&(12) = _LOADIMAGE("bg\blendgrasswoodsbottomright2.png") ground&(13) = _LOADIMAGE("bg\blendgrasswoodsbottomleft2.png") ground&(14) = _LOADIMAGE("bg\blendgrasswoodstopleft2.png") ground&(15) = _LOADIMAGE("bg\blendgrasswoodsubottom.png") ground&(16) = _LOADIMAGE("bg\blendgrasswoodsuleft.png") ground&(17) = _LOADIMAGE("bg\blendgrasswoodsutop.png") ground&(18) = _LOADIMAGE("bg\blendgrasswoodsuright.png") ground&(19) = _LOADIMAGE("bg\blendgrasswoodscornerstop.png") ground&(20) = _LOADIMAGE("bg\blendgrasswoodscornersright.png") ground&(21) = _LOADIMAGE("bg\blendgrasswoodscornersbottom.png") ground&(22) = _LOADIMAGE("bg\blendgrasswoodscornersleft.png") ground&(23) = _LOADIMAGE("bg\blendgrasswoodsclearing.png") ground&(24) = _LOADIMAGE("bg\blendgrasswoodstopbottomright.png") ground&(25) = _LOADIMAGE("bg\blendgrasswoodstopbottomleft.png") ground&(26) = _LOADIMAGE("bg\blendgrasswoodsbottomtopright.png") ground&(27) = _LOADIMAGE("bg\blendgrasswoodsbottomtopleft.png") ground&(28) = _LOADIMAGE("bg\blendgrasswoodsrightbottomleft.png") ground&(29) = _LOADIMAGE("bg\blendgrasswoodsrighttopleft.png") ground&(30) = _LOADIMAGE("bg\blendgrasswoodsleftbottomright.png") ground&(31) = _LOADIMAGE("bg\blendgrasswoodslefttopright.png") ground&(32) = _LOADIMAGE("bg\blendgrasswoodshoriz.png") ground&(33) = _LOADIMAGE("bg\blendgrasswoodsvert.png") ground&(34) = _LOADIMAGE("bg\blendgrasswoodstopwithcorners.png") ground&(35) = _LOADIMAGE("bg\blendgrasswoodsrightwithcorners.png") ground&(36) = _LOADIMAGE("bg\blendgrasswoodsbottomwithcorners.png") ground&(37) = _LOADIMAGE("bg\blendgrasswoodsleftwithcorners.png") ground&(38) = _LOADIMAGE("bg\blendgrasswoodstoprightcurve.png") ground&(39) = _LOADIMAGE("bg\blendgrasswoodsbottomrightcurve.png") ground&(40) = _LOADIMAGE("bg\blendgrasswoodsbottomleftcurve.png") ground&(41) = _LOADIMAGE("bg\blendgrasswoodstopleftcurve.png") ground&(42) = _LOADIMAGE("bg\blendgrasswoodsforwardslash.png") ground&(43) = _LOADIMAGE("bg\blendgrasswoodsbackslash.png") pointx% = INT(RND * 16) pointy% = INT(RND * 16) topo%(pointx%, pointy%) = 1 size% = 64 DO UNTIL size% = 0 pointx% = pointx% + INT(RND * 3) - 1 IF pointx% > 15 THEN pointx% = 14: size% = size% + 1 IF pointx% < 0 THEN pointx% = 1: size% = size% + 1 pointy% = pointy% + INT(RND * 3) - 1 IF pointy% > 15 THEN pointy% = 14: size% = size% + 1 IF pointy% < 0 THEN pointy% = 1: size% = size% + 1 topo%(pointx%, pointy%) = 1 size% = size% - 1 LOOP 'pointx% = INT(RND * 16) 'pointy% = INT(RND * 16) 'topo%(pointx%, pointy%) = 2 'dir% = INT(RND * 8) 'DO UNTIL pointx% <= 0 OR pointx% >= 15 OR pointy% <= 0 OR pointy% >= 15 ' IF pointx% >= 0 AND pointx% <= 15 AND pointy% >= 0 AND pointy% <= 15 THEN ' IF COS(pi / 4 * dir%) > -.1 THEN pointx% = pointx% + INT(1.5 * COS(pi / 4 * dir%)) ' IF SIN(pi / 4 * dir%) > -.1 THEN pointy% = pointy% + INT(1.5 * SIN(pi / 4 * dir%)) ' IF COS(pi / 4 * dir%) < -.1 THEN pointx% = pointx% + INT(.5 * COS(pi / 4 * dir%)) ' IF SIN(pi / 4 * dir%) < -.1 THEN pointy% = pointy% + INT(.5 * SIN(pi / 4 * dir%)) ' dir% = dir% + INT(RND * 3) - 1 ' IF dir% < 0 THEN dir% = 7 ' IF dir% > 7 THEN dir% = 0 ' topo%(pointx%, pointy%) = 2 ' END IF 'LOOP genground topo%() allground& = _NEWIMAGE(4096 + swidth, 4096 + sheight, 32) _DEST allground&: CLS: _DEST 0 FOR y = 0 TO 15 FOR x = 0 TO 15 _PUTIMAGE (x * 256 + (swidth / 2 - 100), y * 256 + sheight / 2), ground&(topo%(x, y)), allground& NEXT NEXT _FREEIMAGE ground&(0) _FREEIMAGE ground&(1) FOR freeground% = 3 TO 43 IF ground&(freeground%) THEN _FREEIMAGE ground&(freeground%) NEXT player& = _LOADIMAGE("ui\player.png") plane& = _LOADIMAGE("ui\plane.png") missileimage& = _LOADIMAGE("ui\missile.png") weapon& = _LOADIMAGE("ui\electricweapons.png") aug& = _LOADIMAGE("ui\electricmods.png") stat& = _LOADIMAGE("ui\electricstats.png") premetal& = _LOADIMAGE("bg\brushedmetal.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) explosioneffect& = _COPYIMAGE(blob(128, 128, _RGB(255, 0, 0), _RGB(255, 255, 0))) contraileffect& = _COPYIMAGE(blob(16, 16, _RGB(127, 127, 127), _RGB(127, 127, 127))) plasshot& = _COPYIMAGE(blob(8, 8, _RGB(0, 255, 0), _RGB(127, 255, 0))) spreadshot& = _COPYIMAGE(blob(8, 8, _RGB(0, 0, 255), _RGB(0, 127, 255))) pulseshot& = _COPYIMAGE(blob(8, 8, _RGB(127, 0, 255), _RGB(255, 0, 255))) flareimage& = _COPYIMAGE(blob(8, 8, _RGB(255, 0, 0), _RGB(255, 255, 255))) _DEST 0 _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& _CLEARCOLOR _RGB(0, 0, 0), player& _CLEARCOLOR _RGB(0, 0, 0), plane& _CLEARCOLOR _RGB(0, 0, 0), missileimage& _CLEARCOLOR _RGB(0, 0, 0), weapon& _CLEARCOLOR _RGB(0, 0, 0), aug& _CLEARCOLOR _RGB(0, 0, 0), stat& DIM wepimage&(11) DIM modimage&(4) DIM statimage&(4) DIM tooltips&(4) _SOURCE weapon& FOR wep% = 1 TO 8 wepimage&(wep%) = _NEWIMAGE(32, 32, 32) _DEST wepimage&(wep%) FOR y% = 0 TO 31 FOR x% = 0 TO 31 PSET (x%, y%), POINT(x% + (wep% - 1) * 32, y%) NEXT NEXT NEXT blankmissile& = _NEWIMAGE(32, 32, 32) _DEST blankmissile& FOR y% = 0 TO 31 FOR x% = 0 TO 31 PSET (x%, y%), POINT(x%, y% + 32) NEXT NEXT FOR wep% = 1 TO 4 modimage&(wep%) = _NEWIMAGE(32, 32, 32) statimage&(wep%) = _NEWIMAGE(32, 32, 32) _SOURCE aug& _DEST modimage&(wep%) FOR y% = 0 TO 31 FOR x% = 0 TO 31 PSET (x%, y%), POINT(x% + (wep% - 1) * 32, y%) NEXT NEXT _SOURCE stat& _DEST statimage&(wep%) FOR y% = 0 TO 31 FOR x% = 0 TO 31 PSET (x%, y%), POINT(x% + (wep% - 1) * 32, y%) NEXT NEXT NEXT _SOURCE 0 _DEST 0 wepimage&(9) = recolor&(blankmissile&, _RGB(255, 255, 255), _RGB(0, 0, 255)) wepimage&(10) = recolor&(blankmissile&, _RGB(255, 255, 255), _RGB(0, 127, 0)) wepimage&(11) = _NEWIMAGE(32, 32, 32) _PUTIMAGE (0, 0), weapon&, wepimage&(11), (32, 32)-(63, 63) _FREEIMAGE blankmissile& _FREEIMAGE weapon& _FREEIMAGE aug& _FREEIMAGE stat& wepimage&(0) = _NEWIMAGE(32, 32, 32) modimage&(0) = _NEWIMAGE(32, 32, 32) _CLEARCOLOR _RGB(0, 0, 0), wepimage&(0) _CLEARCOLOR _RGB(0, 0, 0), modimage&(0) tooltips&(1) = _LOADIMAGE("ui\tooltips\aimer_tooltip.png") tooltips&(2) = _LOADIMAGE("ui\tooltips\energy_armor_tooltip.png") tooltips&(3) = _LOADIMAGE("ui\tooltips\srb_tooltip.png") tooltips&(4) = _LOADIMAGE("ui\tooltips\flare_tooltip.png") OPEN "electricsettings.cfg" FOR RANDOM AS #1 LEN = LEN(swidth) GET #1, 5, red GET #1, 6, green GET #1, 7, blue GET #1, 8, difficulty IF gamepad <> 0 THEN DIM steering AS control, throttle AS control, primary AS control, secondary AS control, scrdown AS control, scrup AS control, pick AS control GET #1, 10, steering.number GET #1, 11, throttle.number GET #1, 12, primary.number GET #1, 13, secondary.number GET #1, 16, scrdown.number GET #1, 17, scrup.number GET #1, 18, pick.number GET #1, 20, steering.axis GET #1, 21, throttle.axis GET #1, 22, primary.axis GET #1, 23, secondary.axis GET #1, 24, scrdown.axis GET #1, 25, scrup.axis GET #1, 26, pick.axis picked% = 1 numdevice% = _DEVICES buttons% = _LASTBUTTON(gamepad) DO WHILE _DEVICEINPUT(gamepad) LOOP END IF GET #1, 14, livery GET #1, 15, team GET #1, 19, vol CLOSE #1 _DEST allground& 'we need the player's color to do this LINE (0, sheight / 2)-(swidth / 2 - 100, 4095 + sheight / 2), _RGB(red, green, blue), BF LINE (4096 + swidth / 2 - 100, sheight / 2)-(4096 + swidth - 200, 4095 + sheight / 2), _RGB(255, 0, 0), BF LINE (swidth / 2 - 100, 0)-(4095 + swidth / 2 - 100, sheight / 2), _RGB(0, 255, 0), BF LINE (swidth / 2 - 100, 4096 + sheight / 2)-(4095 + swidth / 2 - 100, 4096 + sheight), _RGB(255, 255, 0), BF _DEST 0 IF team < 1 THEN team = 1 IF team > 4 THEN team = 4 planeshadow& = shadow&(plane&) quartz& = _LOADFONT("fonts\segment14.otf", 16) bigquartz& = _LOADFONT("fonts\segment14.otf", 32) cyberbit& = _LOADFONT("fonts\cyberbit.ttf", 24, "") numplanes% = team * 4 - 1 DIM points(3) AS score DIM planes(15) AS airplane DIM mods(15, 4) AS aug DIM weapons(15, 5) AS weapon DIM lazers(5000) AS shot DIM missiles(50) AS missile DIM contrails%(5000, 2) DIM explosions%(200, 4) DIM trails%(1000, 3) DIM flares(130, 4) DIM wepstorage(15, 15) AS weapon DIM modstorage(15, 15) AS aug DIM controller(30) DIM debriss(260) AS debris FOR teammates = 0 TO team - 1 planes(0 + 4 * teammates).blip = recolor&(player&, _RGB(255, 255, 255), _RGB(red, green, blue)) planes(1 + 4 * teammates).blip = recolor&(player&, _RGB(255, 255, 255), _RGB(255, 0, 0)) planes(2 + 4 * teammates).blip = recolor&(player&, _RGB(255, 255, 255), _RGB(0, 255, 0)) planes(3 + 4 * teammates).blip = recolor&(player&, _RGB(255, 255, 255), _RGB(255, 255, 0)) IF livery = 0 THEN planes(0 + 4 * teammates).image = recolor&(plane&, _RGB(255, 255, 255), _RGB(red, green, blue)) planes(1 + 4 * teammates).image = recolor&(plane&, _RGB(255, 255, 255), _RGB(255, 0, 0)) planes(2 + 4 * teammates).image = recolor&(plane&, _RGB(255, 255, 255), _RGB(0, 255, 0)) planes(3 + 4 * teammates).image = recolor&(plane&, _RGB(255, 255, 255), _RGB(255, 255, 0)) ELSE planes(0 + 4 * teammates).image = colorgreyspectrum&(plane&, _RGB(red, green, blue)) planes(1 + 4 * teammates).image = colorgreyspectrum&(plane&, _RGB(255, 0, 0)) planes(2 + 4 * teammates).image = colorgreyspectrum&(plane&, _RGB(0, 255, 0)) planes(3 + 4 * teammates).image = colorgreyspectrum&(plane&, _RGB(255, 255, 0)) END IF planes(0 + 4 * teammates).team = 0 planes(0 + 4 * teammates).x = 300 planes(0 + 4 * teammates).y = 300 planes(0 + 4 * teammates).lasthit = 2 planes(0 + 4 * teammates).ai = 1 planes(1 + 4 * teammates).team = 1 planes(1 + 4 * teammates).x = 3796 planes(1 + 4 * teammates).y = 3796 planes(1 + 4 * teammates).dir = pi planes(1 + 4 * teammates).lasthit = 3 planes(1 + 4 * teammates).ai = 1 planes(2 + 4 * teammates).team = 2 planes(2 + 4 * teammates).x = 3796 planes(2 + 4 * teammates).y = 300 planes(2 + 4 * teammates).dir = pi / 2 planes(2 + 4 * teammates).lasthit = 1 planes(2 + 4 * teammates).ai = 1 planes(3 + 4 * teammates).team = 3 planes(3 + 4 * teammates).x = 300 planes(3 + 4 * teammates).y = 3796 planes(3 + 4 * teammates).dir = 3 / 2 * pi planes(3 + 4 * teammates).lasthit = 0 planes(3 + 4 * teammates).ai = 1 NEXT planes(0).ai = 0 'un-comment the next line for practically unlimited credits 'planes(0).credits = 9999 'uncomment the next four lines for practically unlimited radar-guided missiles 'weapons(0, 5).wep = 10 'weapons(0, 5).ifon = -1 'weapons(0, 5).total = 60 'weapons(0, 5).ammo = 9999 fcont% = 1 numlazer% = 0 DIM wepmouse AS weapon DIM modmouse AS aug DIM blankspace AS weapon FOR k% = 0 TO numplanes% planes(k%).force = 3 planes(k%).speed = 3 planes(k%).battery = 100 planes(k%).generator = 1 planes(k%).armor = 10 planes(k%).ammo = 1000 planes(k%).maxbatt = 100 planes(k%).maxarm = 10 weapons(k%, 2).wep = 1 weapons(k%, 2).ifon = -1 weapons(k%, 2).total = 12 weapons(k%, 2).energy = .25 NEXT music& = _SNDOPEN("electric_game.ogg", "sync,vol") IF music& <> 0 THEN _SNDVOL music&, vol * .8 _SNDLOOP music& END IF DO _LIMIT 61 DO lclick% = _MOUSEBUTTON(1) LOOP WHILE _MOUSEINPUT 'CLS IF planes(0).market = 0 THEN scrollground allground& IF xoffset% > 0 THEN LINE (0, yoffset%)-(xoffset% - 1, 4095 + yoffset%), _RGB(red, green, blue), BF COLOR _RGB(255 - red, 255 - green, 255 - blue) _PRINTSTRING (-152 + xoffset%, sheight / 2 - 16), "Market" IF planes(0).waittime > 0 THEN _PRINTSTRING (-152 + xoffset%, sheight / 2), "Closed" ELSE _PRINTSTRING (-148 + xoffset%, sheight / 2), "Open!" COLOR _RGB(255, 255, 255) END IF IF gamepad <> 0 THEN IF gamepad <= numdevice% THEN DO WHILE _DEVICEINPUT(gamepad) FOR a% = 1 TO buttons% controller(a%) = _BUTTON(a%) NEXT FOR b% = 1 TO _LASTAXIS controller(b% + buttons%) = _AXIS(b%) NEXT LOOP IF controller(buttons% * scrdown.axis + scrdown.number) AND ignoretog% = 0 THEN picked% = picked% - 1: ignoretog% = -1 IF controller(buttons% * scrup.axis + scrup.number) AND ignoretog% = 0 THEN picked% = picked% + 1: ignoretog% = -1 IF picked% <= 0 THEN picked% = 9 IF picked% >= 10 THEN picked% = 1 END IF END IF IF planes(0).armor > 0 THEN IF gamepad = 0 THEN playercontrol planes(0).dir, planes(0).force, planes(0).yaw, 0, 0 IF planes(0).market = 0 THEN playerfire planes(), 0, weapons(), 0, 0 ELSE playercontrol planes(0).dir, planes(0).force, planes(0).yaw, controller(buttons% * steering.axis + steering.number), controller(buttons% * throttle.axis + throttle.number) IF planes(0).market = 0 THEN playerfire planes(), 0, weapons(), ABS(controller(buttons% * primary.axis + primary.number)) + .5, ABS(controller(buttons% * secondary.axis + secondary.number)) + .5 END IF END IF IF planes(0).x <= 0 AND planes(0).waittime <= 0 THEN planes(0).x = -128: planes(0).force = 0: planes(0).speed = 0: planes(0).market = 1 IF planes(0).speed < 2.5 AND planes(0).force < 2 AND planes(0).armor > 0 THEN COLOR _RGB(255, 0, 0): _PRINTSTRING ((swidth - _PRINTWIDTH("STALL WARNING!")) / 2, sheight / 2 + 32), "STALL WARNING!": COLOR _RGB(255, 255, 255) screenanchorx% = INT(planes(0).x) screenanchory% = INT(planes(0).y) xoffset% = -screenanchorx% + swidth / 2 - 100 yoffset% = -screenanchory% + sheight / 2 FOR k% = 0 TO numplanes% FOR wepn% = 1 TO 3 IF weapons(k%, wepn%).kind = 0 THEN IF weapons(k%, wepn%).remaining < weapons(k%, wepn%).total THEN weapons(k%, wepn%).remaining = weapons(k%, wepn%).remaining + 1 IF weapons(k%, wepn%).firing = 1 THEN weapons(k%, wepn%).firing = 0 makeshot lazers(), numlazer%, planes(k%), k%, weapons(k%, wepn%).wep, wepn%, planes(0).market planes(k%).battery = planes(k%).battery - weapons(k%, wepn%).energy planes(k%).ammo = planes(k%).ammo - weapons(k%, wepn%).ammo IF wepn% = 2 OR wepn% = 3 THEN planes(k%).battery = planes(k%).battery - weapons(k%, wepn%).energy planes(k%).ammo = planes(k%).ammo - weapons(k%, wepn%).ammo END IF END IF END IF IF weapons(k%, wepn%).kind = 1 THEN IF weapons(k%, wepn%).firing >= 1 AND NOT _KEYDOWN(32) AND NOT lclick AND NOT controller(1) THEN makecharge lazers(), numlazer%, k%, planes(), weapons(k%, wepn%).wep, weapons(k%, wepn%).firing, wepn%, numplanes% planes(k%).battery = planes(k%).battery - weapons(k%, wepn%).firing / 6 IF wepn% = 2 OR wepn% = 3 THEN planes(k%).battery = planes(k%).battery - weapons(k%, wepn%).firing / 6 weapons(k%, wepn%).firing = 0 END IF END IF NEXT FOR wepn% = 4 TO 5 IF weapons(k%, wepn%).remaining < weapons(k%, wepn%).total THEN weapons(k%, wepn%).remaining = weapons(k%, wepn%).remaining + 1 IF weapons(k%, wepn%).firing = 1 THEN weapons(k%, wepn%).firing = 0 makemissile missiles(), nummissile%, k%, planes(), weapons(k%, wepn%).wep, numplanes% weapons(k%, wepn%).ammo = weapons(k%, wepn%).ammo - 1 END IF IF weapons(k%, wepn%).ammo <= 0 THEN weapons(k%, wepn%) = blankspace NEXT IF planes(k%).battery >= 1 THEN FOR augm% = 1 TO 4 IF mods(k%, augm%).ifon = -1 THEN IF mods(k%, augm%).kind = 1 THEN aimer planes(), k%, numplanes% IF mods(k%, augm%).kind = 2 THEN converter planes(k%), mods(k%, augm%).ifon IF mods(k%, augm%).kind = 3 THEN srb planes(k%), contrails%(), numcontrail%, mods(k%, augm%) IF mods(k%, augm%).kind = 4 THEN flare k%, planes(k%), missiles(), nummissile%, mods(k%, augm%), flares(), numflare% planes(k%).battery = planes(k%).battery - mods(k%, augm%).energy / 60 END IF NEXT END IF IF planes(k%).armor <= 0 THEN respawn planes(k%) IF planes(k%).ai = 1 AND planes(k%).armor > 0 THEN aiplane k%, planes(), weapons(), difficulty SELECT CASE planes(k%).team CASE 0: IF planes(k%).x <= 0 THEN aimarket planes(k%), k%, weapons(), wepstorage() CASE 1: IF planes(k%).x >= 4095 THEN aimarket planes(k%), k%, weapons(), wepstorage() CASE 2: IF planes(k%).y <= 0 THEN aimarket planes(k%), k%, weapons(), wepstorage() CASE 3: IF planes(k%).y >= 4095 THEN aimarket planes(k%), k%, weapons(), wepstorage() END SELECT END IF planes(k%).dir = planes(k%).dir + rad(1.5 * planes(k%).yaw) togglecontrol k%, weapons(), mods(), ignoretog%, picked%, controller(pick.number) IF planes(k%).speed < 2 AND planes(k%).market = 0 THEN planes(k%).armor = 0 crash planes(), explosions%(), points(), numexplosion%, numplanes%, difficulty, mods(), debriss(), numdebris% END IF planes(k%).x = planes(k%).x + COS(planes(k%).dir) * planes(k%).speed planes(k%).y = planes(k%).y + SIN(planes(k%).dir) * planes(k%).speed IF planes(k%).market = 0 AND planes(k%).x < 0 THEN planes(k%).x = 0 IF planes(k%).x > 4095 THEN planes(k%).x = 4095 IF planes(k%).y < 0 THEN planes(k%).y = 0 IF planes(k%).y > 4095 THEN planes(k%).y = 4095 planes(k%).battery = planes(k%).battery + planes(k%).generator / 30 - planes(k%).force * 1 / 150 IF planes(k%).battery < 0 THEN planes(k%).battery = 0: IF planes(k%).force > planes(k%).generator * 5 THEN planes(k%).force = planes(k%).generator * 5 fakephysics planes(k%).force, planes(k%).speed IF planes(k%).battery > planes(k%).maxbatt THEN planes(k%).battery = planes(k%).maxbatt IF planes(0).market = 0 THEN IF planes(k%).x + xoffset% > 0 AND planes(k%).x + xoffset% < swidth - 200 AND planes(k%).y + yoffset% > 0 AND planes(k%).y + yoffset% < sheight AND planes(k%).armor > 0 THEN IF planes(k%).yaw <= -.7 THEN IF graphsetting = 1 THEN rotator planes(k%).x + 16 + xoffset%, planes(k%).y + 16 + yoffset%, planes(k%).dir, planeshadow&, 0, 0, 31, 31, 32 maketrail planes(k%).x + COS(planes(k%).dir - pi / 2) * 8, planes(k%).y + SIN(planes(k%).dir - pi / 2) * 8, trails%(), numtrail%, k% maketrail planes(k%).x + COS(planes(k%).dir + pi / 2) * 8, planes(k%).y + SIN(planes(k%).dir + pi / 2) * 8, trails%(), numtrail%, k% + numplanes% + 1 END IF rotator planes(k%).x + xoffset%, planes(k%).y + yoffset%, planes(k%).dir, planes(k%).image, 0, 0, 31, 31, 32 END IF IF planes(k%).yaw > -.7 AND planes(k%).yaw < -.3 THEN IF graphsetting = 1 THEN rotator planes(k%).x + 16 + xoffset%, planes(k%).y + 16 + yoffset%, planes(k%).dir, planeshadow&, 32, 0, 63, 31, 32 rotator planes(k%).x + xoffset%, planes(k%).y + yoffset%, planes(k%).dir, planes(k%).image, 32, 0, 63, 31, 32 END IF IF planes(k%).yaw >= -.3 AND planes(k%).yaw <= .3 THEN IF graphsetting = 1 THEN rotator planes(k%).x + 16 + xoffset%, planes(k%).y + 16 + yoffset%, planes(k%).dir, planeshadow&, 64, 0, 95, 31, 32 rotator planes(k%).x + xoffset%, planes(k%).y + yoffset%, planes(k%).dir, planes(k%).image, 64, 0, 95, 31, 32 END IF IF planes(k%).yaw > .3 AND planes(k%).yaw < .7 THEN IF graphsetting = 1 THEN rotator planes(k%).x + 16 + xoffset%, planes(k%).y + 16 + yoffset%, planes(k%).dir, planeshadow&, 96, 0, 127, 31, 32 rotator planes(k%).x + xoffset%, planes(k%).y + yoffset%, planes(k%).dir, planes(k%).image, 96, 0, 127, 31, 32 END IF IF planes(k%).yaw >= .7 THEN IF graphsetting = 1 THEN rotator planes(k%).x + 16 + xoffset%, planes(k%).y + 16 + yoffset%, planes(k%).dir, planeshadow&, 128, 0, 159, 31, 32 maketrail planes(k%).x + COS(planes(k%).dir - pi / 2) * 8, planes(k%).y + SIN(planes(k%).dir - pi / 2) * 8, trails%(), numtrail%, k% maketrail planes(k%).x + COS(planes(k%).dir + pi / 2) * 8, planes(k%).y + SIN(planes(k%).dir + pi / 2) * 8, trails%(), numtrail%, k% + numplanes% + 1 END IF rotator planes(k%).x + xoffset%, planes(k%).y + yoffset%, planes(k%).dir, planes(k%).image, 128, 0, 159, 31, 32 END IF '_PRINTSTRING (planes(k%).x + xoffset%, planes(k%).y + yoffset%), whatever you need END IF IF planes(k%).waittime > 0 THEN planes(k%).waittime = planes(k%).waittime - 1 END IF NEXT debriseffect debriss(), numdebris%, explosions%(), numexplosion% lazer lazers(), planes(), points(), numlazer%, explosions%(), numexplosion%, numplanes%, difficulty, plasshot&, spreadshot&, pulseshot&, mods(), debriss(), numdebris% charge lazers(), planes(), numlazer% missile missiles(), planes(), points(), nummissile%, contrails%(), numcontrail%, missileimage&, explosions%(), numexplosion%, numplanes%, difficulty, mods(), debriss(), numdebris% contrail contrails%(), numcontrail%, contraileffect& flareeffect flares(), numflare%, contrails%(), numcontrail%, flareimage& explosion explosions%(), numexplosion%, explosioneffect& IF graphsetting = 1 THEN trail trails%(), numtrail%, numplanes% IF planes(0).market = 0 THEN _PUTIMAGE (swidth - 200, 0)-(swidth - 1, sheight - 1), brushedmetal&, 0, (swidth - 200, 0)-(swidth - 1, sheight - 1) hudbar 0, "PWR", planes(0).force / 10 * 100, 100, _RGB(127, 0, 0), "%", quartz& hudbar 1, "GEN", planes(0).generator / 2 * 100, 100, _RGB(0, 127, 0), "%", quartz& hudbar 2, "BAT", planes(0).battery / planes(0).maxbatt * 100, 100, _RGB(127, 127, 0), "%", quartz& hudbar 3, "SPD", planes(0).speed / 10 * 645.6, 645.6, _RGB(0, 127, 127), "mph", quartz& hudbar 4, "ARM", planes(0).armor / planes(0).maxarm * 100, 100, _RGB(0, 0, 127), "%", quartz& hudbar 5, "AMO", planes(0).ammo / 100, 100, _RGB(31, 31, 31), "%", quartz& _FONT quartz& _PRINTSTRING (swidth - 200, 208), "PTS " + LTRIM$(STR$(points(0).points)) _PRINTSTRING (swidth - 200, 240), "CR. " + LTRIM$(STR$(planes(0).credits)) _FONT 16 weaponhud swidth - 180, sheight / 2, weapons(), 0, wepimage&(), picked% modhud swidth - 164, sheight / 2 + 80, mods(), 0, modimage&(), picked% LINE (swidth - 180, sheight - 180)-(swidth - 21, sheight - 21), _RGB(0, 63, 0), BF FOR blip% = 0 TO numplanes% rotator swidth - 180 + planes(blip%).x \ 25.6, sheight - 180 + planes(blip%).y \ 25.6, planes(blip%).dir, planes(blip%).blip, 0, 0, 16, 16, 8 NEXT LINE (swidth - 180 - ((swidth - 200) \ 51.2) + planes(0).x \ 25.6, sheight - 180 - (sheight \ 51.2) + planes(0).y \ 25.6)-(swidth - 180 + ((swidth - 200) \ 51.2) + planes(0).x \ 25.6, sheight - 180 + (sheight \ 51.2) + planes(0).y \ 25.6), _RGB(255, 255, 255), B END IF IF planes(0).market = 1 THEN market planes(0), 0, weapons(), mods(), wepimage&(), modimage&(), statimage&(), wepstorage(), modstorage(), wepmouse, modmouse, whichstore%, bigquartz&, quartz&, cyberbit&, brushedmetal&, tooltips&(), difficulty IF _KEYDOWN(112) THEN leaderboard planes(), points(), numplanes% _DISPLAY SLEEP END IF IF _KEYDOWN(9) THEN leaderboard planes(), points(), numplanes% _DISPLAY IF ignoretog% <> 0 AND _KEYDOWN(49) = 0 AND _KEYDOWN(50) = 0 AND _KEYDOWN(51) = 0 AND _KEYDOWN(52) = 0 AND _KEYDOWN(53) = 0 AND _KEYDOWN(54) = 0 AND _KEYDOWN(55) = 0 AND _KEYDOWN(56) = 0 AND _KEYDOWN(57) = 0 THEN IF gamepad = 0 THEN ignoretog% = 0 ELSE IF controller(scrdown.number) = 0 AND controller(scrup.number) = 0 AND controller(pick.number) = 0 THEN ignoretog% = 0 END IF END IF IF _KEYDOWN(27) AND ignore` = 0 THEN EXIT DO clickonce LOOP _FONT cyberbit& CLS _PUTIMAGE , brushedmetal& leaderboard planes(), points(), numplanes% _PRINTSTRING (swidth / 2 - 256, 320), "Press any key to go back to the Main Menu." _DISPLAY IF music& THEN DO UNTIL vol = 0 _LIMIT 30 vol = vol - .02 IF vol < 0 THEN vol = 0 _SNDVOL music&, vol LOOP _SNDSTOP music& _SNDCLOSE music& END IF SLEEP _FREEIMAGE player& _FREEIMAGE plane& _FREEIMAGE planeshadow& _FREEIMAGE missileimage& _FREEIMAGE brushedmetal& _FREEIMAGE explosioneffect& _FREEIMAGE contraileffect& _FREEIMAGE allground& _FREEIMAGE plasshot& _FREEIMAGE spreadshot& _FREEIMAGE pulseshot& FOR freee% = 0 TO 3 FOR teammates% = 0 TO team - 1 _FREEIMAGE planes(freee% + 4 * teammates%).image _FREEIMAGE planes(freee% + 4 * teammates%).blip NEXT NEXT FOR free8% = 0 TO 11 _FREEIMAGE wepimage&(free8%) NEXT FOR free4% = 1 TO 4 _FREEIMAGE modimage&(free4%) _FREEIMAGE statimage&(free4%) NEXT _FONT 16 IF quartz& <> 0 THEN _FREEFONT (quartz&) IF bigquartz& <> 0 THEN _FREEFONT (bigquartz&) IF cyberbit& <> 0 THEN _FREEFONT (cyberbit&) END SUB SUB crash (planes() AS airplane, explosions%(), points() AS score, numexplosions%, numplanes%, difficulty, mods() AS aug, debriss() AS debris, numdebris%) 'Resets planes after they crash, and makes the crash sound boom& = _SNDOPEN("sfx\factory_destroyed.wav", "sync") FOR a% = 0 TO numplanes% IF planes(a%).armor <= 0 AND planes(a%).respawntime <= 0 THEN IF boom& THEN _SNDPLAY boom& makeexplosion planes(a%).x, planes(a%).y, explosions%(), numexplosion%, 60, 0 makedebris planes(a%), debriss(), numdebris% planes(a%).respawntime = 60 planes(a%).force = 0 planes(a%).speed = 0 FOR m = 1 TO 4 mods(a%, m).ifon = 0 NEXT team% = planes(planes(a%).lasthit).team points(team%).points = points(team%).points + 1 points(team%).total = points(team%).points - points(team%).losses points(planes(a%).team).losses = points(planes(a%).team).losses + 1 points(planes(a%).team).total = points(planes(a%).team).points - points(planes(a%).team).losses planes(planes(a%).lasthit).credits = planes(planes(a%).lasthit).credits + 1 IF planes(planes(a%).lasthit).ai = 1 AND difficulty = 1 THEN marketchance% = INT(RND * 12) 'originally, 12 was (13 - planes(planes(a%).lasthit).credits) IF marketchance% = 0 THEN planes(planes(a%).lasthit).market = 1 END IF END IF NEXT _SNDCLOSE boom& END SUB SUB respawn (plane AS airplane) IF plane.respawntime > 0 THEN plane.respawntime = plane.respawntime - 1 IF plane.respawntime <= 0 THEN plane.x = INT(RND * 4090) + 3 plane.y = INT(RND * 4090) + 3 plane.dir = RND * 2 * pi plane.force = 3 plane.speed = 3 plane.battery = plane.maxbatt plane.armor = plane.maxarm END IF END SUB SUB leaderboard (planes() AS airplane, points() AS score, numplanes%) DIM order(3) AS INTEGER FOR find = 0 TO 3 IF points% > points(find).total THEN points% = points(find).total NEXT DO FOR rank% = 0 TO 3 IF points(rank%).total = points% THEN order(3 - checked%) = rank%: checked% = checked% + 1 NEXT points% = points% + 1 LOOP UNTIL checked% = 4 FOR thelasttime% = 0 TO 3 _PUTIMAGE (swidth / 2 - 224, 64 + 64 * thelasttime%), planes(order(thelasttime%)).image, , (64, 0)-(95, 31) _PRINTSTRING (swidth / 2 - 256, 64 + 64 * thelasttime%), LTRIM$(STR$(thelasttime% + 1)) + "." _PRINTSTRING (swidth / 2 - 176, 64 + 64 * thelasttime%), LTRIM$(STR$(points(planes(order(thelasttime%)).team).points)) + " Points | " + LTRIM$(STR$(points(planes(order(thelasttime%)).team).losses)) + " Losses | " + LTRIM$(STR$(points(planes(order(thelasttime%)).team).total)) + " Total" IF order(thelasttime%) = 0 THEN _PRINTSTRING (swidth / 2 - 328, 64 + 64 * thelasttime%), "Player" NEXT END SUB SUB options 'The options menu DIM steering AS control, throttle AS control, primary AS control, secondary AS control, scrdown AS control, scrup AS control, pick AS control OPEN "electricsettings.cfg" FOR RANDOM AS #1 LEN = LEN(swidth) GET #1, 1, swidth GET #1, 2, sheight GET #1, 3, fs GET #1, 4, graphsetting GET #1, 5, red GET #1, 6, green GET #1, 7, blue GET #1, 8, difficulty GET #1, 9, gamepad GET #1, 10, steering.number GET #1, 11, throttle.number GET #1, 12, primary.number GET #1, 13, secondary.number GET #1, 14, livery GET #1, 15, team GET #1, 16, scrdown.number GET #1, 17, scrup.number GET #1, 18, pick.number GET #1, 19, vol GET #1, 20, steering.axis GET #1, 21, throttle.axis GET #1, 22, primary.axis GET #1, 23, secondary.axis GET #1, 24, scrdown.axis GET #1, 25, scrup.axis GET #1, 26, pick.axis quartz& = _LOADFONT("fonts\segment14.otf", sheight / 24, "") cyberbit& = _LOADFONT("fonts\cyberbit.ttf", sheight / 32, "") premetal& = _LOADIMAGE("bg\electricplane2.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& numcontroller% = _DEVICES DO _LIMIT 60 CLS _PUTIMAGE (0, 0), brushedmetal& _FONT quartz& COLOR _RGB(255, 200, 0) center "OPTIONS", 1 _FONT cyberbit& COLOR _RGB(255, 255, 255) center "Set Screen Resolution (" + LTRIM$(STR$(swidth)) + " x " + LTRIM$(STR$(sheight)) + ")", 4 IF fs = 0 THEN center "Toggle Fullscreen (off)", 5 ELSE center "Toggle Fulscreen (on)", 5 IF graphsetting = 0 THEN center "Fancyness (Low)", 6 ELSE center "Fancyness (High)", 6 center "Plane color (" + LTRIM$(STR$(red)) + ", " + LTRIM$(STR$(green)) + ", " + LTRIM$(STR$(blue)) + ") -- " + colorhint$(red, green, blue), 7 IF difficulty = 0 THEN center "Enemy AI (good)", 8 ELSE center "Enemy AI (really good)", 8 IF gamepad = 0 THEN center "Input Device: Mouse & Keyboard Only", 9 ELSE center "Input Device: " + controllerparse$(4, gamepad), 9 center "Controls (If you're using a controller)", 10 center "Planes per team: (" + LTRIM$(STR$(team)) + ")", 11 center "Music volume: (" + LTRIM$(STR$(INT(vol * 100))) + "%)", 12 center "Restore Defaults", 13 center "Back", 14 IF menu(4) THEN pickres premetal& = _LOADIMAGE("bg\electricplane2.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& PUT #1, 1, swidth PUT #1, 2, sheight _PRINTMODE _KEEPBACKGROUND _FONT 16 quartz& = _LOADFONT("fonts\segment14.otf", sheight / 24, "") cyberbit& = _LOADFONT("fonts\cyberbit.ttf", sheight / 32, "") END IF IF menu(5) THEN IF fs = 0 THEN fs = 1 ELSE fs = 0 IF fs = 0 THEN _FULLSCREEN _OFF ELSE _FULLSCREEN PUT #1, 3, fs END IF IF menu(6) THEN IF graphsetting = 0 THEN graphsetting = 1 ELSE graphsetting = 0 PUT #1, 4, graphsetting END IF IF menu(7) THEN colorslider red, green, blue, livery PUT #1, 5, red PUT #1, 6, green PUT #1, 7, blue PUT #1, 14, livery END IF IF menu(8) THEN IF difficulty = 0 THEN difficulty = 1 ELSE difficulty = 0 PUT #1, 8, difficulty END IF IF menu(9) THEN DO gamepad = gamepad + 1 IF gamepad > numcontroller% THEN gamepad = 0 LOOP UNTIL controllerparse$(1, gamepad) = "CONTROLLER" OR gamepad = 0 PUT #1, 9, gamepad END IF IF menu(10) THEN keybind gamepad, steering, throttle, primary, secondary, scrdown, scrup, pick PUT #1, 10, steering.number PUT #1, 11, throttle.number PUT #1, 12, primary.number PUT #1, 13, secondary.number PUT #1, 16, scrdown.number PUT #1, 17, scrup.number PUT #1, 18, pick.number PUT #1, 20, steering.axis PUT #1, 21, throttle.axis PUT #1, 22, primary.axis PUT #1, 23, secondary.axis PUT #1, 24, scrdown.axis PUT #1, 25, scrup.axis PUT #1, 26, pick.axis END IF IF menu(11) THEN team = team + 1 IF team > 4 THEN team = 1 PUT #1, 15, team END IF IF menu(12) THEN volumeslider vol PUT #1, 19, vol IF menu(13) THEN fs = 1 graphsetting = 0 red = 0 green = 0 blue = 255 difficulty = 0 gamepad = 0 steering.number = 1 throttle.number = 3 primary.number = 1 secondary.number = 2 livery = 0 team = 1 scrdown.number = 4 scrup.number = 5 pick.number = 3 vol = 0.8 steering.axis = 1 throttle.axis = 1 primary.axis = 0 secondary.axis = 0 scrdown.axis = 0 scrup.axis = 0 pick.axis = 0 PUT #1, 3, fs PUT #1, 4, graphsetting PUT #1, 5, red PUT #1, 6, green PUT #1, 7, blue PUT #1, 8, difficulty PUT #1, 9, gamepad PUT #1, 10, steering.number PUT #1, 11, throttle.number PUT #1, 12, primary.number PUT #1, 13, secondary.number PUT #1, 14, livery PUT #1, 15, team PUT #1, 16, scrdown.number PUT #1, 17, scrup.number PUT #1, 18, pick.number PUT #1, 19, vol PUT #1, 20, steering.axis PUT #1, 21, throttle.axis PUT #1, 22, primary.axis PUT #1, 23, secondary.axis PUT #1, 24, scrdown.axis PUT #1, 25, scrup.axis PUT #1, 26, pick.axis END IF IF menu(14) THEN EXIT DO END IF clickonce cursor _DISPLAY LOOP CLOSE #1 _FONT 16 IF quartz& <> 0 AND quartz& <> -1 THEN _FREEFONT (quartz&) IF cyberbit& <> 0 AND cyberbit& <> -1 THEN _FREEFONT (cyberbit&) _FREEIMAGE brushedmetal& END SUB SUB pickres 'screen resolution picking dialogue quartz& = _LOADFONT("fonsts\segment14.otf", sheight / 16, "") cyberbit& = _LOADFONT("fonts\cyberbit.ttf", sheight / 32, "") premetal& = _LOADIMAGE("bg\brushedmetal.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& DIM resarray(16) AS res RESTORE resolutions FOR a% = 1 TO 16 READ resarray(a%).x, resarray(a%).y, resarray(a%).caption NEXT DO _LIMIT 60 CLS _PUTIMAGE (0, 0), brushedmetal& _FONT quartz& COLOR _RGB(255, 200, 0) center "SCREEN RESOLUTION", 1 _FONT cyberbit& COLOR _RGB(255, 255, 255) FOR a% = 1 TO 16 center LTRIM$(STR$(resarray(a%).x)) + " x " + LTRIM$(STR$(resarray(a%).y)) + " " + RTRIM$(resarray(a%).caption), a% + 3 NEXT center "Back", 21 FOR a% = 1 TO 16 IF menu(3 + a%) THEN swidth = resarray(a%).x sheight = resarray(a%).y SCREEN _NEWIMAGE(swidth, sheight, 32) _PRINTMODE _KEEPBACKGROUND premetal& = _LOADIMAGE("bg\brushedmetal.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& _FONT 16 quartz& = _LOADFONT("fonts\segment14.otf", sheight / 16, "") cyberbit& = _LOADFONT("fonts\cyberbit.ttf", sheight / 32, "") END IF NEXT IF menu(21) THEN _FONT 16 EXIT DO END IF cursor clickonce _DISPLAY LOOP IF quartz& <> 0 THEN _FREEFONT (quartz&) 'IF cyberbit& <> 0 THEN _FREEFONT (cyberbit&) _FREEIMAGE brushedmetal& resolutions: DATA 800,600,"(Smallest supported resolution, SVGA)" DATA 1024,600,"(Most netbooks)" DATA 1024,768,"(XGA, Many older 4:3 LCD monitors)" DATA 1280,720,"(720p)" DATA 1280,768,"(Wide XGA 5:3)" DATA 1280,800,"(Wide XGA 16:10)" DATA 1280,960,"(SXGA-)" DATA 1280,1024,"(SXGA)" DATA 1366,768,"(Many consumer laptops)" DATA 1440,900,"(Wide SXGA)" DATA 1600,900,"(900p, many modern 16:9 monitors)" DATA 1600,1200,"(UXGA)" DATA 1680,1050,"(Common widescreen 16:10 monitors)" DATA 1920,1080,"(Full HD)" DATA 1920,1200,"(Common 23''-25'' monitor resolution)" DATA 2560,1600,"(High-end gaming monitors)" END SUB FUNCTION colorhint$ (red, green, blue) 'The 64 color names colorint% = red \ 64 + 4 * (green \ 64) + 16 * (blue \ 64) SELECT CASE colorint% CASE 0: colorhint$ = "Black" CASE 1: colorhint$ = "Dark Red" CASE 2: colorhint$ = "Crimson" CASE 3: colorhint$ = "Red" CASE 4: colorhint$ = "Forest Green" CASE 5: colorhint$ = "Dark yellow" CASE 6: colorhint$ = "Brown" CASE 7: colorhint$ = "Orange" CASE 8: colorhint$ = "Green" CASE 9: colorhint$ = "Dark Olive" CASE 10: colorhint$ = "Deep Yellow" CASE 11: colorhint$ = "Yellow Orange" CASE 12: colorhint$ = "Bright Green" CASE 13: colorhint$ = "Grass Green" CASE 14: colorhint$ = "Yellow Green" CASE 15: colorhint$ = "Yellow" CASE 16: colorhint$ = "Dark Blue" CASE 17: colorhint$ = "Dark Purple" CASE 18: colorhint$ = "Maroon" CASE 19: colorhint$ = "Hot Pink" CASE 20: colorhint$ = "Dark Teal" CASE 21: colorhint$ = "Dark Grey" CASE 22: colorhint$ = "Rose" CASE 23: colorhint$ = "Light Red" CASE 24: colorhint$ = "Dark Blue Green" CASE 25: colorhint$ = "Drab Green" CASE 26: colorhint$ = "Drab Yellow" CASE 27: colorhint$ = "Salmon" CASE 28: colorhint$ = "Mint" CASE 29: colorhint$ = "Sage" CASE 30: colorhint$ = "Lime" CASE 31: colorhint$ = "Dusty Yellow" CASE 32: colorhint$ = "Indigo" CASE 33: colorhint$ = "Purple" CASE 34: colorhint$ = "Violet" CASE 35: colorhint$ = "Bright Purple" CASE 36: colorhint$ = "8 Blue" CASE 37: colorhint$ = "Navy" CASE 38: colorhint$ = "Lavender" CASE 39: colorhint$ = "Pink" CASE 40: colorhint$ = "That color that looks bad on cars" CASE 41: colorhint$ = "Seafoam Blue" CASE 42: colorhint$ = "Light Grey" CASE 43: colorhint$ = "Light Pink" CASE 44: colorhint$ = "Light Teal" CASE 45: colorhint$ = "Seafoam Green" CASE 46: colorhint$ = "Light Green" CASE 47: colorhint$ = "Pale Yellow" CASE 48: colorhint$ = "Electric Blue" CASE 49: colorhint$ = "Light Indigo" CASE 50: colorhint$ = "Light Purple" CASE 51: colorhint$ = "Magenta" CASE 52: colorhint$ = "Blue" CASE 53: colorhint$ = "Light Blue" CASE 54: colorhint$ = "Light Lavender" CASE 55: colorhint$ = "Light Magenta" CASE 56: colorhint$ = "Sky Blue" CASE 57: colorhint$ = "Cornfield" CASE 58: colorhint$ = "Pale Blue" CASE 59: colorhint$ = "Pale Magenta" CASE 60: colorhint$ = "Cyan" CASE 61: colorhint$ = "Light Cyan" CASE 62: colorhint$ = "Pale Cyan" CASE 63: colorhint$ = "White" END SELECT END FUNCTION SUB buttonbind (gamepad, button AS control) numdevice% = _DEVICES done% = 0 center "?", 9 _DISPLAY DO WHILE _DEVICEINPUT(gamepad) LOOP DO IF _DEVICEINPUT(gamepad) THEN FOR a% = 1 TO _LASTBUTTON(gamepad) IF _BUTTONCHANGE(a%) THEN button.number = a% button.axis = 0 done% = 1 END IF NEXT FOR a% = 1 TO _LASTAXIS(gamepad) IF ABS(_AXIS(a%)) >= .5 THEN button.number = a% button.axis = 1 done% = 1 END IF NEXT END IF LOOP UNTIL done% = 1 END SUB SUB keybind (gamepad, steering AS control, throttle AS control, primary AS control, secondary AS control, scrdown AS control, scrup AS control, pick AS control) premetal& = _LOADIMAGE("bg\brushedmetal.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& numdevice% = _DEVICES IF gamepad <= numdevice% AND gamepad <> 0 THEN DO _LIMIT 60 CLS _PUTIMAGE (0, 0), brushedmetal& IF steering.axis THEN steerstring$ = "Steering: Axis " + LTRIM$(STR$(steering.number)) ELSE steerstring$ = "Steering: Button " + LTRIM$(STR$(steering.number)) center steerstring$, 1 IF throttle.axis THEN throtstring$ = "Throttle: Axis " + LTRIM$(STR$(throttle.number)) ELSE throtstring$ = "Throttle: Button " + LTRIM$(STR$(throttle.number)) center throtstring$, 2 IF primary.axis THEN primstring$ = "Fire Primary: Axis " + LTRIM$(STR$(primary.number)) ELSE primstring$ = "Fire Primary: Button " + LTRIM$(STR$(primary.number)) center primstring$, 3 IF secondary.axis THEN secondstring$ = "Fire Secondary: Axis " + LTRIM$(STR$(secondary.number)) ELSE secondstring$ = "Fire Secondary: Button " + LTRIM$(STR$(secondary.number)) center secondstring$, 4 IF scrup.axis THEN upstring$ = "Next Weapon/Mod: Axis " + LTRIM$(STR$(scrup.number)) ELSE upstring$ = "Next Weapon/Mod: Button " + LTRIM$(STR$(scrup.number)) center upstring$, 5 IF scrdown.axis THEN downstring$ = "Last Weapon/Mod: Axis " + LTRIM$(STR$(scrdown.number)) ELSE downstring$ = "Last Weapon/Mod: Button " + LTRIM$(STR$(scrdown.number)) center downstring$, 6 IF pick.axis THEN pickstring$ = "Toggle Weapon/Mod: Axis " + LTRIM$(STR$(pick.number)) ELSE pickstring$ = "Toggle Weapon/Mod: Button " + LTRIM$(STR$(pick.number)) center pickstring$, 7 center "Back", 8 IF menu(1) THEN buttonbind gamepad, steering IF menu(2) THEN buttonbind gamepad, throttle IF menu(3) THEN buttonbind gamepad, primary IF menu(4) THEN buttonbind gamepad, secondary IF menu(5) THEN buttonbind gamepad, scrup IF menu(6) THEN buttonbind gamepad, scrdown IF menu(7) THEN buttonbind gamepad, pick testaxis = 0 IF menu(8) THEN EXIT DO cursor clickonce _DISPLAY LOOP END IF _FREEIMAGE brushedmetal& CLOSE #2 END SUB SUB colorslider (red, green, blue, livery) 'The RGB color sliders to choose plane colors DIM colory(2) plane& = _LOADIMAGE("ui\plane.png") _CLEARCOLOR _RGB(0, 0, 0), plane& premetal& = _LOADIMAGE("bg\brushedmetal.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& liv1& = recolor&(plane&, _RGB(255, 255, 255), _RGB(red, green, blue)) liv2& = colorgreyspectrum(plane&, _RGB(red, green, blue)) DO DO mousex% = _MOUSEX mousey% = _MOUSEY lclick% = _MOUSEBUTTON(1) LOOP WHILE _MOUSEINPUT _LIMIT 60 CLS _PUTIMAGE (0, 0), brushedmetal& PRINT "Press 'Esc' to go back." colory(0) = 279 - red colory(1) = 279 - green colory(2) = 279 - blue LINE (swidth / 2 - 33, 24)-(swidth / 2 - 32, 279), _RGB(127, 0, 0), B LINE (swidth / 2 - 1, 24)-(swidth / 2, 279), _RGB(0, 127, 0), B LINE (swidth / 2 + 31, 24)-(swidth / 2 + 32, 279), _RGB(0, 0, 127), B IF trigger(swidth / 2 - 40, 16, swidth / 2 - 25, 287, mousex%, mousey%) AND lclick% THEN colory(0) = mousey%: liv1& = recolor&(plane&, _RGB(255, 255, 255), _RGB(red, green, blue)): liv2& = colorgreyspectrum(plane&, _RGB(red, green, blue)) IF trigger(swidth / 2 - 8, 16, swidth / 2 + 7, 287, mousex%, mousey%) AND lclick% THEN colory(1) = mousey%: liv1& = recolor&(plane&, _RGB(255, 255, 255), _RGB(red, green, blue)): liv2& = colorgreyspectrum(plane&, _RGB(red, green, blue)) IF trigger(swidth / 2 + 24, 16, swidth / 2 + 39, 287, mousex%, mousey%) AND lclick% THEN colory(2) = mousey%: liv1& = recolor&(plane&, _RGB(255, 255, 255), _RGB(red, green, blue)): liv2& = colorgreyspectrum(plane&, _RGB(red, green, blue)) FOR a% = 0 TO 2 IF colory(a%) < 24 THEN colory(a%) = 24 IF colory(a%) > 279 THEN colory(a%) = 279 NEXT LINE (swidth / 2 - 40, colory(0) - 8)-(swidth / 2 - 25, colory(0) + 7), _RGB(255, 0, 0), BF LINE (swidth / 2 - 8, colory(1) - 8)-(swidth / 2 + 7, colory(1) + 7), _RGB(0, 255, 0), BF LINE (swidth / 2 + 24, colory(2) - 8)-(swidth / 2 + 39, colory(2) + 7), _RGB(0, 0, 255), BF red = 279 - colory(0) green = 279 - colory(1) blue = 279 - colory(2) center LTRIM$(STR$(red)) + ", " + LTRIM$(STR$(green)) + ", " + LTRIM$(STR$(blue)), 16 _PUTIMAGE (swidth / 2 - 32, 310), liv1&, , (64, 0)-(95, 31) _PUTIMAGE (swidth / 2, 310), liv2&, , (64, 0)-(95, 31) IF trigger(swidth / 2 - 32, 310, swidth / 2 - 1, 341, mousex%, mousey%) AND lclick% THEN livery = 0 IF trigger(swidth / 2, 310, swidth / 2 + 31, 341, mousex%, mousey%) AND lclick% THEN livery = 1 IF livery = 0 THEN LINE (swidth / 2 - 32, 310)-(swidth / 2 - 1, 341), _RGB(255, 255, 255), B IF livery = 1 THEN LINE (swidth / 2, 310)-(swidth / 2 + 31, 341), _RGB(255, 255, 255), B cursor _DISPLAY LOOP UNTIL _KEYDOWN(27) _FREEIMAGE plane& _FREEIMAGE brushedmetal& END SUB SUB volumeslider (vol) premetal& = _LOADIMAGE("bg\brushedmetal.png") brushedmetal& = _NEWIMAGE(swidth, sheight, 32) _PUTIMAGE (0, 0)-(swidth - 1, sheight - 1), premetal&, brushedmetal& _FREEIMAGE premetal& DO DO mousex% = _MOUSEX mousey% = _MOUSEY lclick% = _MOUSEBUTTON(1) LOOP WHILE _MOUSEINPUT _LIMIT 60 CLS _PUTIMAGE (0, 0), brushedmetal& PRINT "Press 'Esc' to go back." LINE (swidth / 2 - 1, 24)-(swidth / 2, 279), _RGB(255, 255, 255), B IF trigger(swidth / 2 - 8, 16, swidth / 2 + 7, 287, mousex%, mousey%) AND lclick% THEN vol = INT((279 - mousey%) / 2.55) / 100 IF vol > 1 THEN vol = 1 IF vol < 0 THEN vol = 0 LINE (swidth / 2 - 8, 279 - vol * 255 - 8)-(swidth / 2 + 7, 279 - vol * 255 + 7), _RGB(255, 255, 255), BF center LTRIM$(STR$(INT(vol * 100))) + "%", 16 cursor _DISPLAY LOOP UNTIL _KEYDOWN(27) _FREEIMAGE brushedmetal& END SUB SUB genground (topo%()) FOR y% = 0 TO 15 FOR x% = 0 TO 15 IF topo%(x%, y%) = 0 THEN IF x% - 1 >= 0 AND y% - 1 >= 0 THEN IF topo%(x% - 1, y% - 1) = 1 THEN topo%(x%, y%) = 3 IF x% + 1 <= 15 AND y% - 1 >= 0 THEN IF topo%(x% + 1, y% - 1) = 1 THEN topo%(x%, y%) = 4 IF x% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% + 1) = 1 THEN topo%(x%, y%) = 5 IF x% + 1 <= 15 AND y% + 1 <= 15 THEN IF topo%(x% + 1, y% + 1) = 1 THEN topo%(x%, y%) = 6 IF x% - 1 >= 0 AND y% - 1 >= 0 AND x% + 1 <= 15 THEN IF topo%(x% - 1, y% - 1) = 1 AND topo%(x% + 1, y% - 1) = 1 THEN topo%(x%, y%) = 19 IF x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% + 1, y% - 1) = 1 AND topo%(x% + 1, y% + 1) = 1 THEN topo%(x%, y%) = 20 IF x% - 1 >= 0 AND y% + 1 <= 15 AND x% + 1 <= 15 THEN IF topo%(x% - 1, y% + 1) = 1 AND topo%(x% + 1, y% + 1) = 1 THEN topo%(x%, y%) = 21 IF x% - 1 >= 0 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% - 1) = 1 AND topo%(x% - 1, y% + 1) = 1 THEN topo%(x%, y%) = 22 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% + 1) = 1 AND topo%(x% + 1, y% - 1) = 1 THEN topo%(x%, y%) = 42 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% - 1) = 1 AND topo%(x% + 1, y% + 1) = 1 THEN topo%(x%, y%) = 43 IF y% - 1 >= 0 THEN IF topo%(x%, y% - 1) = 1 THEN topo%(x%, y%) = 7 IF x% + 1 <= 15 THEN IF topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 8 IF y% + 1 <= 15 THEN IF topo%(x%, y% + 1) = 1 THEN topo%(x%, y%) = 9 IF x% - 1 >= 0 THEN IF topo%(x% - 1, y%) = 1 THEN topo%(x%, y%) = 10 IF x% - 1 >= 0 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% - 1) = 1 AND topo%(x%, y% + 1) = 1 THEN topo%(x%, y%) = 24 IF x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% + 1, y% - 1) = 1 AND topo%(x%, y% + 1) = 1 THEN topo%(x%, y%) = 25 IF x% - 1 >= 0 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x%, y% - 1) = 1 AND topo%(x% - 1, y% + 1) = 1 THEN topo%(x%, y%) = 26 IF x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x%, y% - 1) = 1 AND topo%(x% + 1, y% + 1) = 1 THEN topo%(x%, y%) = 27 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x% + 1, y% - 1) = 1 THEN topo%(x%, y%) = 28 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x% + 1, y% + 1) = 1 THEN topo%(x%, y%) = 29 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 THEN IF topo%(x% - 1, y% - 1) = 1 AND topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 30 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% + 1) = 1 AND topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 31 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% - 1) = 1 AND topo%(x% + 1, y% - 1) = 1 AND topo%(x, y% + 1) = 1 THEN topo%(x%, y%) = 34 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x% + 1, y% - 1) = 1 AND topo%(x% + 1, y% + 1) = 1 THEN topo%(x%, y%) = 35 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% + 1) = 1 AND topo%(x% + 1, y% + 1) = 1 AND topo%(x%, y% - 1) = 1 THEN topo%(x%, y%) = 36 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% - 1) = 1 AND topo%(x% - 1, y% + 1) = 1 AND topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 37 IF x% + 1 <= 15 AND y% - 1 >= 0 THEN IF topo%(x%, y% - 1) = 1 AND topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 11 IF x% + 1 <= 15 AND y% + 1 <= 15 THEN IF topo%(x% + 1, y%) = 1 AND topo%(x%, y% + 1) = 1 THEN topo%(x%, y%) = 12 IF x% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x%, y% + 1) = 1 THEN topo%(x%, y%) = 13 IF x% - 1 >= 0 AND y% - 1 >= 0 THEN IF topo%(x%, y% - 1) = 1 AND topo%(x% - 1, y%) = 1 THEN topo%(x%, y%) = 14 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% + 1) = 1 AND topo%(x%, y% - 1) = 1 AND topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 38 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y% - 1) = 1 AND topo%(x%, y% + 1) = 1 AND topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 39 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x%, y% + 1) = 1 AND topo%(x% + 1, y% - 1) = 1 THEN topo%(x%, y%) = 40 IF x% - 1 >= 0 AND x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x%, y% - 1) = 1 AND topo%(x% + 1, y% + 1) = 1 THEN topo%(x%, y%) = 41 IF y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x%, y% - 1) = 1 AND topo%(x%, y% + 1) = 1 THEN topo%(x%, y%) = 32 IF x% - 1 >= 0 AND x% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 33 IF x% - 1 >= 0 AND y% + 1 <= 15 AND x% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x%, y% + 1) = 1 AND topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 15 IF x% - 1 >= 0 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x%, y% - 1) = 1 AND topo%(x%, y% + 1) = 1 THEN topo%(x%, y%) = 16 IF x% - 1 >= 0 AND y% - 1 >= 0 AND x% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x%, y% - 1) = 1 AND topo%(x% + 1, y%) = 1 THEN topo%(x%, y%) = 17 IF x% + 1 <= 15 AND y% - 1 >= 0 AND y% + 1 <= 15 THEN IF topo%(x%, y% - 1) = 1 AND topo%(x% + 1, y%) = 1 AND topo%(x%, y% + 1) = 1 THEN topo%(x%, y%) = 18 IF x% - 1 >= 0 AND y% - 1 >= 0 AND x% + 1 <= 15 AND y% + 1 <= 15 THEN IF topo%(x% - 1, y%) = 1 AND topo%(x%, y% - 1) = 1 AND topo%(x% + 1, y%) = 1 AND topo%(x%, y% + 1) = 1 THEN topo%(x%, y%) = 23 END IF NEXT NEXT END SUB SUB scrollground (allground&) 'Makes the scrolling background with all the grass -- rivers are planned for the future. Demensions are 4096 + screen width - 200 x 4096 + screen height. IF allground& THEN _PUTIMAGE (0, 0)-(swidth - 200, sheight), allground&, 0, (screenanchorx%, screenanchory%)-(screenanchorx% + swidth - 200, screenanchory% + sheight) END IF END SUB SUB aimarket (player AS airplane, plane%, weapons() AS weapon, wepstorage() AS weapon) DIM switchvar AS weapon FOR k% = 0 TO 15 FOR l% = 1 TO 5 IF wepstorage(plane%, k%).wep = 0 AND weapons(plane%, l%).wep <> 0 THEN switchvar = weapons(plane%, l%) weapons(plane%, l%) = wepstorage(plane%, k%) wepstorage(plane%, k%) = switchvar IF l% = 2 OR l% = 3 THEN FOR look% = 0 TO 15 IF wepstorage(plane%, look%).wep = 0 THEN wepstorage(plane%, look%) = switchvar: EXIT FOR NEXT END IF EXIT FOR END IF NEXT NEXT choice% = INT(RND * 14) + 1 SELECT CASE choice% CASE 1: IF player.credits >= 3 THEN selectweapon 1, plane%, wepstorage(): player.credits = player.credits - 3 CASE 2: IF player.credits >= 3 THEN selectweapon 2, plane%, wepstorage(): player.credits = player.credits - 3 CASE 3: IF player.credits >= 3 THEN selectweapon 3, plane%, wepstorage(): player.credits = player.credits - 3 CASE 4: IF player.credits >= 3 THEN selectweapon 4, plane%, wepstorage(): player.credits = player.credits - 3 CASE 5: IF player.credits >= 3 THEN selectweapon 5, plane%, wepstorage(): player.credits = player.credits - 3 CASE 6: IF player.credits >= 5 THEN selectweapon 6, plane%, wepstorage(): player.credits = player.credits - 5 CASE 9: IF player.credits >= 4 THEN selectmissile 1, plane%, wepstorage(): player.credits = player.credits - 4 CASE 10: IF player.credits >= 5 THEN selectmissile 2, plane%, wepstorage(): player.credits = player.credits - 5 CASE 11: IF player.credits >= 6 THEN selectmissile 3, plane%, wepstorage(): player.credits = player.credits - 6 CASE 12: IF player.credits >= 5 AND player.generator < 1 THEN player.generator = player.generator + .1: player.credits = player.credits - 5 CASE 13: IF player.credits >= 5 AND player.maxbatt < 200 THEN player.maxbatt = player.maxbatt + 10: player.credits = player.credits - 5 CASE 14: IF player.credits >= 5 AND player.maxarm < 20 THEN player.maxarm = player.maxarm + 1: player.credits = player.credits - 5 CASE 15: IF player.credits >= 1 AND player.ammo < 10000 THEN player.ammo = player.ammo + 1000: player.credits = player.credits - 1 END SELECT FOR a% = 2 TO 3 FOR k% = 0 TO 15 IF wepstorage(plane%, k%).wep <> 0 AND wepstorage(plane%, k%).wep <= 8 THEN FOR look% = 0 TO 15 IF wepstorage(plane%, look%).wep = wepstorage(plane%, k%).wep AND look% <> k% THEN switchvar = weapons(plane%, a%) weapons(plane%, a%) = wepstorage(plane%, k%) wepstorage(plane%, k%) = switchvar wepstorage(plane%, look%) = switchvar EXIT FOR: EXIT FOR END IF NEXT END IF NEXT NEXT FOR k% = 0 TO 15 IF wepstorage(plane%, k%).wep <> 0 AND wepstorage(plane%, k%).wep <= 8 THEN switchvar = weapons(plane%, 1) weapons(plane%, 1) = wepstorage(plane%, k%) wepstorage(plane%, k%) = switchvar EXIT FOR END IF NEXT FOR a% = 4 TO 5 FOR k% = 0 TO 15 IF wepstorage(plane%, k%).wep >= 9 THEN switchvar = weapons(plane%, a%) weapons(plane%, a%) = wepstorage(plane%, k%) wepstorage(plane%, k%) = switchvar EXIT FOR END IF NEXT NEXT player.market = 0 player.force = 3 player.speed = 3 player.battery = player.maxbatt SELECT CASE player.team CASE 0 player.x = 32 player.dir = 0 CASE 1 player.x = 4063 player.dir = pi CASE 2 player.y = 32 player.dir = pi / 2 CASE 3 player.y = 4063 player.dir = 3 * pi / 2 END SELECT END SUB SUB market (player AS airplane, plane%, weapons() AS weapon, mods() AS aug, wepimage&(), modimage&(), statimage&(), wepstorage() AS weapon, modstorage() AS aug, wepmouse AS weapon, modmouse AS aug, whichstore%, quartz&, quartz2&, cyberbit&, brushedmetal&, tooltips&(), difficulty) 'Handles the markets _FONT cyberbit& DO mousex% = _MOUSEX mousey% = _MOUSEY lclick% = _MOUSEBUTTON(1) LOOP WHILE _MOUSEINPUT CLS _PUTIMAGE (0, 0), brushedmetal& IF trigger(0, 0, 191, 31, mousex%, mousey%) AND lclick% THEN whichstore% = 0 IF trigger(192, 0, 383, 31, mousex%, mousey%) AND lclick% THEN whichstore% = 1 IF trigger(384, 0, 575, 31, mousex%, mousey%) AND lclick% THEN whichstore% = 2 SELECT CASE whichstore% CASE 0: wepmarket player.credits, plane%, weapons(), wepimage&(), wepstorage(), wepmouse, quartz2& CASE 1: modmarket player.credits, plane%, mods(), modimage&(), modstorage(), modmouse, tooltips&() CASE 2: statmarket player, statimage&(), quartz2& END SELECT _FONT quartz& PRINT " WEAPONS | MODS | STATS |" _FONT cyberbit& IF difficulty <> 0 THEN _PRINTSTRING (swidth - _PRINTWIDTH("Time: " + LTRIM$(STR$(60 - player.markettime \ 60))), sheight - 72), "Time: " + LTRIM$(STR$(60 - player.markettime \ 60)) _PRINTSTRING (swidth - _PRINTWIDTH("Cr. " + LTRIM$(STR$(player.credits))), sheight - 48), "Cr. " + LTRIM$(STR$(player.credits)) _PRINTSTRING (swidth - _PRINTWIDTH("EXIT"), sheight - 24), "EXIT" IF trigger(swidth - _PRINTWIDTH("EXIT"), sheight - 24, swidth - 1, sheight - 1, mousex%, mousey%) AND lclick% = -1 AND ignore` = 0 OR player.markettime >= 3600 AND difficulty <> 0 OR _KEYDOWN(27) THEN player.market = 0 player.x = 32 player.dir = 0 player.force = 3 player.speed = 3 player.battery = player.maxbatt player.waittime = player.waittime + player.markettime * 2 player.markettime = 0 _FONT 16 ignore` = -1 END IF player.markettime = player.markettime + 1 cursor clickonce END SUB SUB wepmarket (credits%, plane%, weapons() AS weapon, wepimage&(), storage() AS weapon, inmouse AS weapon, quartz&) 'The market with the weapons in it DIM switchvar AS weapon DIM blankspace AS weapon DO mousex% = _MOUSEX mousey% = _MOUSEY lclick% = _MOUSEBUTTON(1) rclick% = _MOUSEBUTTON(2) LOOP WHILE _MOUSEINPUT LINE (0, 0)-(191, 31), _RGB(127, 0, 0), BF FOR wep% = 1 TO 11 _PUTIMAGE (0, wep% * 32), wepimage&(wep%) NEXT _PRINTSTRING (32, 32), "Laser - Cr.3" _PRINTSTRING (32, 64), "Vulcan - Cr.3" _PRINTSTRING (32, 96), "Spread - Cr.3" _PRINTSTRING (32, 128), "Plasma - Cr.3" _PRINTSTRING (32, 160), "Gauss - Cr.3" _PRINTSTRING (32, 192), "Avenger - Cr.5" _PRINTSTRING (32, 224), "Homing Plasma - Cr.5" _PRINTSTRING (32, 256), "Pulse - Cr.5" _PRINTSTRING (32, 288), "10 Heat-Seeker Missiles - Cr.4" _PRINTSTRING (32, 320), "10 Radar-Guided Missiles - Cr.5" _PRINTSTRING (32, 352), "4 Cruise Missiles - Cr.6" weaponhud swidth - 180, 20, weapons(), plane%, wepimage&(), 0 _PRINTSTRING (swidth - 180, 104), "STORAGE" grid swidth - 164, 128 FOR y% = 0 TO 3 FOR x% = 0 TO 3 _PUTIMAGE (swidth - 164 + x% * 32, 128 + y% * 32), wepimage&(storage(0, x% + 4 * y%).wep) IF storage(0, x% + 4 * y%).wep >= 9 THEN _PRINTSTRING (swidth - 133 - _PRINTWIDTH(LTRIM$(STR$(storage(0, x% + 4 * y%).ammo))) + x% * 32, 159 - _FONTHEIGHT + y% * 32), LTRIM$(STR$(storage(0, x% + 4 * y%).ammo)) IF trigger(swidth - 164 + x% * 32, 128 + y% * 32, swidth - 133 + x% * 32, 159 + y% * 32, mousex%, mousey%) AND lclick% AND ignore` = 0 THEN IF storage(0, x% + 4 * y%).wep >= 9 THEN IF storage(0, x% + 4 * y%).wep = inmouse.wep THEN storage(0, x% + 4 * y%).ammo = storage(0, x% + 4 * y%).ammo + inmouse.ammo inmouse = blankspace END IF END IF switchvar = inmouse inmouse = storage(0, x% + 4 * y%) storage(0, x% + 4 * y%) = switchvar ignore` = -1 END IF IF trigger(swidth - 164 + x% * 32, 128 + y% * 32, swidth - 133 + x% * 32, 159 + y% * 32, mousex%, mousey%) AND rclick% AND ignore` = 0 THEN storage(0, x% + 4 * y%) = blankspace ignore` = -1 END IF NEXT NEXT changeweapons swidth - 180, 20, mousex%, mousey%, lclick%, plane%, inmouse, weapons(), storage() _PUTIMAGE (mousex% - 16, mousey% - 16), wepimage&(inmouse.wep) IF trigger(0, 32, swidth - 200, 63, mousex%, mousey%) THEN nrg = 1.25: dam = 25: rpm = 300: spd = 16: amo = 0 specattr1$ = "None" 'wot "A standard laser cannon, with medium rate of fire, medium power, and medium energy consumption.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 3 AND ignore` = 0 THEN selectweapon 1, 0, storage(): credits% = credits% - 3: ignore` = -1 END IF IF trigger(0, 64, swidth - 200, 95, mousex%, mousey%) THEN nrg = 0: dam = 30: rpm = 3600: spd = 20: amo = 60 specattr1$ = "Spread angle = 3" + CHR$(248) 'wot "A heavy machine gun with a high fire rate. Since it's a balistic weapon, it uses bullets rather than energy.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 3 AND ignore` = 0 THEN selectweapon 2, 0, storage(): credits% = credits% - 3: ignore` = -1 END IF IF trigger(0, 96, swidth - 200, 127, mousex%, mousey%) THEN nrg = 2.25: dam = 56.25: rpm = 450: spd = 16: amo = 0 specattr1$ = "Bullets/shot = 3" specattr2$ = "Spread angle = 60" + CHR$(248) 'wot "A unique energy weapon that fires three shots at even angles -- one strait forward, and one on each side.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 3 AND ignore` = 0 THEN selectweapon 3, 0, storage(): credits% = credits% - 3: ignore` = -1 END IF IF trigger(0, 128, swidth - 200, 159, mousex%, mousey%) THEN nrg = 5: dam = 100: rpm = 600: spd = 18: amo = 0 specattr1$ = "None" 'wot "A high-power blaster. It has a high firing rate and energy consumption, so watch your battery.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 3 AND ignore` = 0 THEN selectweapon 4, 0, storage(): credits% = credits% - 3: ignore` = -1 END IF IF trigger(0, 160, swidth - 200, 191, mousex%, mousey%) THEN nrg = 0: dam = 30: rpm = 450: spd = 20: amo = 60 specattr1$ = "Bullets/shot = 8" specattr2$ = "Spread angle = 3" + CHR$(248) 'wot "A machine gun that, instead of firing individual bullets consecutively, loads all barrels and fires them all at once.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 3 AND ignore` = 0 THEN selectweapon 5, 0, storage(): credits% = credits% - 3: ignore` = -1 END IF IF trigger(0, 192, swidth - 200, 223, mousex%, mousey%) THEN nrg = 0: dam = 60: rpm = 3600: spd = 20: amo = 60 specattr1$ = "Recoil effect" specattr2$ = "Spread angle = 3" + CHR$(248) 'wot "This powerful machine gun's recoil is more powerful than your engine, so throttle up.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 5 AND ignore` = 0 THEN selectweapon 6, 0, storage(): credits% = credits% - 5: ignore` = -1 END IF IF trigger(0, 224, swidth - 200, 255, mousex%, mousey%) THEN nrg = 10: dam = 60: rpm = 3600: spd = 12: amo = 0 specattr1$ = "Charged" specattr2$ = "Homing" 'wot "A charging weapon that fires a slow homing shot. Good to have when you run out of missiles.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 5 AND ignore` = 0 THEN selectweapon 7, 0, storage(): credits% = credits% - 5: ignore` = -1 END IF IF trigger(0, 256, swidth - 200, 287, mousex%, mousey%) THEN nrg = 10: dam = 60: rpm = 3600: spd = 16: amo = 0 specattr1$ = "Charged" specattr2$ = "Ghost" 'wot "A charging weapon who'se shots continue after hitting something.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 5 AND ignore` = 0 THEN selectweapon 8, 0, storage(): credits% = credits% - 5: ignore` = -1 END IF IF trigger(0, 288, swidth - 200, 319, mousex%, mousey%) THEN nrg = 0: dam = 50: rpm = 60: spd = 16: amo = 1 specattr1$ = "Homing" 'wot "Missiles that home in on whatever they see first.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 4 AND ignore` = 0 THEN selectmissile 1, 0, storage(): credits% = credits% - 4: ignore` = -1 END IF IF trigger(0, 320, swidth - 200, 351, mousex%, mousey%) THEN nrg = 0: dam = 50: rpm = 60: spd = 16: amo = 1 specattr1$ = "Homing (Leads)" 'wot "Homes more accurately than a heat-seeker, and has longer range as well.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 5 AND ignore` = 0 THEN selectmissile 2, 0, storage(): credits% = credits% - 5: ignore` = -1 END IF IF trigger(0, 352, swidth - 200, 383, mousex%, mousey%) THEN nrg = 0: dam = 300: rpm = 60: spd = 16: amo = 1 specattr1$ = "Splash range = 300" specattr2$ = "Homing (weak)" 'wot "It doesn't home very tightly, but it flies for a long time and has a very, very big explosion. It also doesn't require a direct hit.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 6 AND ignore` = 0 THEN selectmissile 3, 0, storage(): credits% = credits% - 6: ignore` = -1 END IF hudbar 8, "NRG", nrg, 10, _RGB(127, 127, 0), "/sec", quartz& hudbar 9, "DAM", dam, 100, _RGB(0, 0, 127), "/sec", quartz& hudbar 10, "RPM", rpm, 3600, _RGB(0, 127, 0), "", quartz& hudbar 11, "SPD", spd, 20, _RGB(0, 127, 127), "", quartz& hudbar 12, "AMO", amo, 60, _RGB(31, 31, 31), "/sec", quartz& _PRINTSTRING (swidth - 200, 416), specattr1$ _PRINTSTRING (swidth - 200, 448), specattr2$ END SUB SUB modmarket (credits%, plane%, mods() AS aug, modimage&(), storage() AS aug, inmouse AS aug, tooltips&()) 'The market with the mods in it DIM switchvar AS aug DIM blankspace AS aug DO mousex% = _MOUSEX mousey% = _MOUSEY lclick% = _MOUSEBUTTON(1) rclick% = _MOUSEBUTTON(2) LOOP WHILE _MOUSEINPUT LINE (192, 0)-(383, 31), _RGB(0, 127, 0), BF FOR wep% = 1 TO 4 _PUTIMAGE (0, wep% * 32), modimage&(wep%) NEXT _PRINTSTRING (32, 32), "Aimer - Cr.3" _PRINTSTRING (32, 64), "Energy ==> Armor - Cr.3" _PRINTSTRING (32, 96), "Solid Rocket Booster - Cr.3" _PRINTSTRING (32, 128), "Flare Pack - Cr.3" modhud swidth - 180, 20, mods(), plane%, modimage&(), 0 _PRINTSTRING (swidth - 180, 104), "STORAGE" grid swidth - 164, 128 FOR y% = 0 TO 3 FOR x% = 0 TO 3 _PUTIMAGE (swidth - 164 + x% * 32, 128 + y% * 32), modimage&(storage(0, x% + 4 * y%).kind) IF storage(0, x% + 4 * y%).ammo > 0 THEN _PRINTSTRING (swidth - 133 - _PRINTWIDTH(LTRIM$(STR$(storage(0, x% + 4 * y%).ammo))) + x% * 32, 159 - _FONTHEIGHT + y% * 32), LTRIM$(STR$(storage(0, x% + 4 * y%).ammo)) IF trigger(swidth - 164 + x% * 32, 128 + y% * 32, swidth - 133 + x% * 32, 159 + y% * 32, mousex%, mousey%) AND lclick% AND ignore` = 0 THEN IF storage(0, x% + 4 * y%).ammo > 0 THEN IF storage(0, x% + 4 * y%).kind = inmouse.kind THEN storage(0, x% + 4 * y%).ammo = storage(0, x% + 4 * y%).ammo + inmouse.ammo inmouse = blankspace END IF END IF switchvar = inmouse inmouse = storage(0, x% + 4 * y%) storage(0, x% + 4 * y%) = switchvar ignore` = -1 END IF IF trigger(swidth - 164 + x% * 32, 128 + y% * 32, swidth - 133 + x% * 32, 159 + y% * 32, mousex%, mousey%) AND rclick% AND ignore` = 0 THEN storage(0, x% + 4 * y%) = blankspace ignore` = -1 END IF NEXT NEXT changemods swidth - 180, 20, mousex%, mousey%, lclick%, plane%, inmouse, mods() _PUTIMAGE (mousex% - 16, mousey% - 16), modimage&(inmouse.kind) IF trigger(0, 32, swidth - 200, 63, mousex%, mousey%) THEN _PUTIMAGE (mousex%, mousey%), tooltips&(1) 'wot "This device displays an estimate of where enemy planes will be when your shots get there, as well as a line to help you aim. Fire when the line crosses a circle. Calibrated for lasers.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 3 AND ignore` = 0 THEN selectmod 1, 0, storage(): credits% = credits% - 3: ignore` = -1 END IF IF trigger(0, 64, swidth - 200, 95, mousex%, mousey%) THEN _PUTIMAGE (mousex%, mousey%), tooltips&(2) 'wot "This device slowly regenerates armor at the cost of electricity. Watch your battery.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 3 AND ignore` = 0 THEN selectmod 2, 0, storage(): credits% = credits% - 3: ignore` = -1 END IF IF trigger(0, 96, swidth - 200, 127, mousex%, mousey%) THEN _PUTIMAGE (mousex%, mousey%), tooltips&(3) 'wot "Simple, but effective, SRBs are used to provide a short boost of speed in case the need for a quick escape arises. It takes no energy, but runs out of fuel after only one use.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 3 AND ignore` = 0 THEN selectmod 3, 0, storage(): credits% = credits% - 3: ignore` = -1 END IF IF trigger(0, 128, swidth - 200, 159, mousex%, mousey%) THEN _PUTIMAGE (mousex%, mousey%), tooltips&(4) 'wot "Using one of these fires four flares that can trick all kinds of missiles. It works 4 out of 5 times.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND credits% >= 3 AND ignore` = 0 THEN selectmod 4, 0, storage(): credits% = credits% - 3: ignore` = -1 END IF END SUB SUB statmarket (player AS airplane, statimage&(), quartz&) 'The market with the stats in it DO mousex% = _MOUSEX mousey% = _MOUSEY lclick% = _MOUSEBUTTON(1) rclick% = _MOUSEBUTTON(2) LOOP WHILE _MOUSEINPUT LINE (384, 0)-(575, 31), _RGB(0, 0, 127), BF FOR wep% = 1 TO 4 _PUTIMAGE (0, wep% * 32), statimage&(wep%) NEXT _PRINTSTRING (32, 32), "+ 5% Generator - Cr. 5 (Currently " + LTRIM$(STR$(INT(player.generator * 50))) + ")" _PRINTSTRING (32, 64), "+ 10% Battery life - Cr.5 (Currently " + LTRIM$(STR$(player.maxbatt)) + ")" _PRINTSTRING (32, 96), "+ 10% Armor - Cr.5 (Currently " + LTRIM$(STR$(player.maxarm * 10)) + ")" _PRINTSTRING (32, 128), "1000 Bullets - Cr.1 (currently " + LTRIM$(STR$(player.ammo)) + ")" IF trigger(0, 32, swidth - 200, 63, mousex%, mousey%) THEN 'wot "A generator upgrade that increases its effectiveness.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND player.credits >= 5 AND ignore` = 0 AND player.generator < 2 THEN player.generator = player.generator + .1: player.credits = player.credits - 5: ignore` = -1 END IF IF trigger(0, 64, swidth - 200, 95, mousex%, mousey%) THEN 'wot "Increases battery storage capacity. Note that the meter on your dashboard displays % of total battery charge.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND player.credits >= 5 AND ignore` = 0 AND player.maxbatt < 200 THEN player.maxbatt = player.maxbatt + 10: player.credits = player.credits - 5: ignore` = -1 END IF IF trigger(0, 96, swidth - 200, 127, mousex%, mousey%) THEN 'wot "Increases the strength of your armor. Note that the meter on your dashboard displays % of total armor.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND player.credits >= 5 AND ignore` = 0 AND player.maxarm < 20 THEN player.maxarm = player.maxarm + 1: player.credits = player.credits - 5: ignore` = -1 END IF IF trigger(0, 128, swidth - 200, 159, mousex%, mousey%) THEN 'wot "Machine gun ammunition.", mousex%, mousey%, mousex% + 256 IF lclick% = -1 AND player.credits >= 1 AND ignore` = 0 AND player.ammo < 10000 THEN player.ammo = player.ammo + 1000: player.credits = player.credits - 1: ignore` = -1 END IF hudbar 8, "GEN", player.generator / 2 * 100, 100, _RGB(0, 127, 0), "/100", quartz& hudbar 9, "BAT", player.maxbatt, 200, _RGB(127, 127, 0), "/200", quartz& hudbar 10, "ARM", player.maxarm * 10, 200, _RGB(0, 0, 127), "/200", quartz& hudbar 11, "AMO", player.ammo, 10000, _RGB(31, 31, 31), "/10000", quartz& END SUB SUB grid (x AS INTEGER, y AS INTEGER) 'Makes the storage grid at coordinates ("x", "y") FOR y2% = 0 TO 4 LINE (x, y + y2% * 32)-(x + 128, y + y2% * 32), _RGB(255, 255, 255) NEXT FOR x2% = 0 TO 4 LINE (x + x2% * 32, y)-(x + x2% * 32, y + 128), _RGB(255, 255, 255) NEXT END SUB SUB selectweapon (num AS INTEGER, plane AS INTEGER, storage() AS weapon) 'Gives the player weapons that pchk buys, and puts them in storage. DIM selection(8) AS weapon selection(1).wep = 1 selection(1).ifon = -1 selection(1).total = 12 selection(1).energy = .25 selection(2).wep = 2 selection(2).ifon = -1 selection(2).total = 1 selection(2).ammo = 1 selection(3).wep = 3 selection(3).ifon = -1 selection(3).total = 8 selection(3).energy = .3 selection(4).wep = 4 selection(4).ifon = -1 selection(4).total = 6 selection(4).energy = .5 selection(5).wep = 5 selection(5).ifon = -1 selection(5).total = 8 selection(5).ammo = 8 selection(6).wep = 6 selection(6).ifon = -1 selection(6).total = 1 selection(6).ammo = 1 selection(7).wep = 7 selection(7).ifon = -1 selection(7).kind = 1 selection(8).wep = 8 selection(8).ifon = -1 selection(8).kind = 1 FOR stor% = 0 TO 15 IF storage(plane, stor%).wep = 0 THEN storage(plane, stor%) = selection(num): EXIT FOR NEXT END SUB SUB selectmissile (num AS INTEGER, plane AS INTEGER, storage() AS weapon) 'Gives the player missiles that pchk buys, and puts them in storage. DIM selection(3) AS weapon selection(1).wep = 9 selection(1).ifon = -1 selection(1).total = 60 selection(1).ammo = 10 selection(2).wep = 10 selection(2).ifon = -1 selection(2).total = 60 selection(2).ammo = 10 selection(3).wep = 11 selection(3).ammo = 4 selection(3).ifon = -1 selection(3).total = 60 FOR stor% = 0 TO 15 IF storage(plane, stor%).wep = selection(num).wep THEN storage(plane, stor%).ammo = storage(plane, stor%).ammo + selection(num).ammo: skip` = -1: EXIT FOR NEXT IF skip` = 0 THEN FOR stor% = 0 TO 15 IF storage(plane, stor%).wep = 0 THEN storage(plane, stor%) = selection(num): EXIT FOR NEXT END IF END SUB SUB selectmod (num AS INTEGER, plane AS INTEGER, storage() AS aug) 'Gives the player mods that pchk buys, and puts them in storage. DIM selection(4) AS aug selection(1).kind = 1 selection(1).energy = .5 selection(2).kind = 2 selection(2).energy = 9 selection(3).kind = 3 selection(3).fuel = 180 selection(3).ammo = 1 selection(4).kind = 4 selection(4).ammo = 3 FOR stor% = 0 TO 15 IF storage(plane, stor%).kind = selection(num).kind AND selection(num).ammo > 0 THEN storage(plane, stor%).ammo = storage(plane, stor%).ammo + selection(num).ammo: skip% = -1: EXIT FOR NEXT IF skip% = 0 THEN FOR stor% = 0 TO 15 IF storage(plane, stor%).kind = 0 THEN storage(plane, stor%) = selection(num): EXIT FOR NEXT END IF END SUB SUB weaponhud (x AS INTEGER, y AS INTEGER, weapons() AS weapon, plane AS INTEGER, wepimage&(), picked%) 'The HUD for the weapons. LINE (x + 64, y)-(x + 95, y + 31), _RGB(255, 0, 0), B IF picked% = 1 THEN LINE (x + 65, y + 1)-(x + 94, y + 30), _RGB(255, 255, 255), B IF weapons(plane, 1).ifon = -1 THEN LINE (x + 66, y + 2)-(x + 93, y + 29), _RGB(127, 0, 0), BF _PUTIMAGE (x + 64, y), wepimage&(weapons(plane, 1).wep) _PRINTSTRING (x + 64, y), "1" LINE (x + 32, y + 16)-(x + 63, y + 47), _RGB(255, 0, 0), B: LINE (x + 96, y + 16)-(x + 127, y + 47), _RGB(255, 0, 0), B IF picked% = 2 THEN LINE (x + 33, y + 17)-(x + 62, y + 46), _RGB(255, 255, 255), B: LINE (x + 97, y + 17)-(x + 126, y + 46), _RGB(255, 255, 255), B IF weapons(plane, 2).ifon = -1 THEN LINE (x + 34, y + 18)-(x + 61, y + 45), _RGB(127, 0, 0), BF: LINE (x + 98, y + 18)-(x + 125, y + 45), _RGB(127, 0, 0), BF _PUTIMAGE (x + 32, y + 16), wepimage&(weapons(plane, 2).wep): _PUTIMAGE (x + 96, y + 16), wepimage&(weapons(plane, 2).wep) _PRINTSTRING (x + 32, y + 16), "2": _PRINTSTRING (x + 96, y + 16), "2" LINE (x, y + 32)-(x + 31, y + 63), _RGB(255, 0, 0), B: LINE (x + 128, y + 32)-(x + 159, y + 63), _RGB(255, 0, 0), B IF picked% = 3 THEN LINE (x + 1, y + 33)-(x + 30, y + 62), _RGB(255, 255, 255), B: LINE (x + 129, y + 33)-(x + 158, y + 62), _RGB(255, 255, 255), B IF weapons(plane, 3).ifon = -1 THEN LINE (x + 2, y + 34)-(x + 29, y + 61), _RGB(127, 0, 0), BF: LINE (x + 130, y + 34)-(x + 157, y + 61), _RGB(127, 0, 0), BF _PUTIMAGE (x, y + 32), wepimage&(weapons(plane, 3).wep): _PUTIMAGE (x + 128, y + 32), wepimage&(weapons(plane, 3).wep) _PRINTSTRING (x, y + 32), "3": _PRINTSTRING (x + 128, y + 32), "3" LINE (x + 64, y + 32)-(x + 95, y + 63), _RGB(0, 0, 255), B IF picked% = 4 THEN LINE (x + 65, y + 33)-(x + 94, y + 62), _RGB(255, 255, 255), B IF weapons(plane, 4).ifon = -1 THEN LINE (x + 66, y + 34)-(x + 93, y + 61), _RGB(0, 0, 127), BF _PUTIMAGE (x + 64, y + 32), wepimage&(weapons(plane, 4).wep) _PRINTSTRING (x + 64, y + 32), "4" _PRINTSTRING (x + 95 - _PRINTWIDTH(LTRIM$(STR$(weapons(plane, 4).ammo))), y + 63 - _FONTHEIGHT), LTRIM$(STR$(weapons(plane, 4).ammo)) LINE (x + 32, y + 48)-(x + 63, y + 79), _RGB(0, 0, 255), B: LINE (x + 96, y + 48)-(x + 127, y + 79), _RGB(0, 0, 255), B IF picked% = 5 THEN LINE (x + 33, y + 49)-(x + 62, y + 78), _RGB(255, 255, 255), B: LINE (x + 97, y + 49)-(x + 126, y + 78), _RGB(255, 255, 255), B IF weapons(plane, 5).ifon = -1 THEN LINE (x + 34, y + 50)-(x + 61, y + 77), _RGB(0, 0, 127), BF: LINE (x + 98, y + 50)-(x + 125, y + 77), _RGB(0, 0, 127), BF _PUTIMAGE (x + 32, y + 48), wepimage&(weapons(plane, 5).wep): _PUTIMAGE (x + 96, y + 48), wepimage&(weapons(plane, 5).wep) _PRINTSTRING (x + 32, y + 48), "5": _PRINTSTRING (x + 96, y + 48), "5" _PRINTSTRING (x + 63 - _PRINTWIDTH(LTRIM$(STR$(weapons(plane, 5).ammo))), y + 79 - _FONTHEIGHT), LTRIM$(STR$(weapons(plane, 5).ammo)): _PRINTSTRING (x + 127 - _PRINTWIDTH(LTRIM$(STR$(weapons(plane, 5).ammo))), y + 79 - _FONTHEIGHT), LTRIM$(STR$(weapons(plane, 5).ammo)) END SUB SUB modhud (x AS INTEGER, y AS INTEGER, mods() AS aug, plane AS INTEGER, modimage&(), picked%) 'The HUD for the mods. LINE (x, y)-(x + 31, y + 31), _RGB(0, 255, 0), B IF picked% = 6 THEN LINE (x + 1, y + 1)-(x + 30, y + 30), _RGB(255, 255, 255), B IF mods(plane, 1).ifon = -1 THEN LINE (x + 2, y + 2)-(x + 29, y + 29), _RGB(0, 127, 0), BF _PUTIMAGE (x, y), modimage&(mods(plane, 1).kind) _PRINTSTRING (x, y), "6" IF mods(plane, 1).ammo > 0 THEN _PRINTSTRING (x + 31 - _PRINTWIDTH(LTRIM$(STR$(mods(plane, 1).ammo))), y + 31 - _FONTHEIGHT), LTRIM$(STR$(mods(plane, 1).ammo)) LINE (x + 32, y)-(x + 63, y + 31), _RGB(0, 255, 0), B IF picked% = 7 THEN LINE (x + 33, y + 1)-(x + 62, y + 30), _RGB(255, 255, 255), B IF mods(plane, 2).ifon = -1 THEN LINE (x + 34, y + 2)-(x + 61, y + 29), _RGB(0, 127, 0), BF _PUTIMAGE (x + 32, y), modimage&(mods(plane, 2).kind) _PRINTSTRING (x + 32, y), "7" IF mods(plane, 2).ammo > 0 THEN _PRINTSTRING (x + 63 - _PRINTWIDTH(LTRIM$(STR$(mods(plane, 1).ammo))), y + 31 - _FONTHEIGHT), LTRIM$(STR$(mods(plane, 2).ammo)) LINE (x + 64, y)-(x + 95, y + 31), _RGB(0, 255, 0), B IF picked% = 8 THEN LINE (x + 65, y + 1)-(x + 94, y + 30), _RGB(255, 255, 255), B IF mods(plane, 3).ifon = -1 THEN LINE (x + 66, y + 2)-(x + 93, y + 29), _RGB(0, 127, 0), BF _PUTIMAGE (x + 64, y), modimage&(mods(plane, 3).kind) _PRINTSTRING (x + 64, y), "8" IF mods(plane, 3).ammo > 0 THEN _PRINTSTRING (x + 95 - _PRINTWIDTH(LTRIM$(STR$(mods(plane, 1).ammo))), y + 31 - _FONTHEIGHT), LTRIM$(STR$(mods(plane, 3).ammo)) LINE (x + 96, y)-(x + 127, y + 31), _RGB(0, 255, 0), B IF picked% = 9 THEN LINE (x + 97, y + 1)-(x + 126, y + 30), _RGB(255, 255, 255), B IF mods(plane, 4).ifon = -1 THEN LINE (x + 98, y + 2)-(x + 125, y + 29), _RGB(0, 127, 0), BF _PUTIMAGE (x + 96, y), modimage&(mods(plane, 4).kind) _PRINTSTRING (x + 96, y), "9" IF mods(plane, 4).ammo > 0 THEN _PRINTSTRING (x + 127 - _PRINTWIDTH(LTRIM$(STR$(mods(plane, 1).ammo))), y + 31 - _FONTHEIGHT), LTRIM$(STR$(mods(plane, 4).ammo)) END SUB SUB changeweapons (x AS INTEGER, y AS INTEGER, mousex AS INTEGER, mousey AS INTEGER, lclick AS INTEGER, plane AS INTEGER, inmouse AS weapon, weapons() AS weapon, storage() AS weapon) 'Allows the player to change the weapons on board DIM switchvar AS weapon DIM blankspace AS weapon SELECT CASE inmouse.wep CASE 0 IF trigger(x + 64, y, x + 95, y + 31, mousex, mousey) AND lclick = -1 AND ignore` = 0 THEN switchvar = inmouse inmouse = weapons(plane, 1) weapons(plane, 1) = switchvar ignore` = -1 END IF IF trigger(x + 32, y + 16, x + 63, y + 47, mousex, mousey) OR trigger(x + 96, y + 16, x + 127, y + 47, mousex, mousey) THEN IF lclick = -1 AND ignore` = 0 THEN FOR look = 0 TO 15 IF storage(0, look).wep = inmouse.wep THEN switchvar = inmouse inmouse = weapons(plane, 2) storage(0, look) = weapons(plane, 2) weapons(plane, 2) = switchvar ignore` = -1 EXIT FOR END IF NEXT END IF END IF IF trigger(x, y + 32, x + 31, y + 63, mousex, mousey) OR trigger(x + 128, y + 32, x + 159, y + 63, mousex, mousey) THEN IF lclick = -1 AND ignore` = 0 THEN FOR look = 0 TO 15 IF storage(0, look).wep = inmouse.wep THEN switchvar = inmouse inmouse = weapons(plane, 3) storage(0, look) = weapons(plane, 3) weapons(plane, 3) = switchvar ignore` = -1 EXIT FOR END IF NEXT END IF END IF IF trigger(x + 64, y + 32, x + 95, y + 63, mousex, mousey) AND lclick = -1 AND ignore` = 0 THEN switchvar = inmouse inmouse = weapons(plane, 4) weapons(plane, 4) = switchvar ignore` = -1 END IF IF trigger(x + 32, y + 48, x + 63, y + 79, mousex, mousey) OR trigger(x + 96, y + 48, x + 127, y + 79, mousex, mousey) THEN IF lclick = -1 AND ignore` = 0 THEN switchvar = inmouse inmouse = weapons(plane, 5) weapons(plane, 5) = switchvar ignore` = -1 END IF END IF CASE 1, 2, 3, 4, 5, 6, 7, 8 IF trigger(x + 64, y, x + 95, y + 31, mousex, mousey) AND lclick = -1 AND ignore` = 0 THEN switchvar = inmouse inmouse = weapons(plane, 1) weapons(plane, 1) = switchvar ignore` = -1 END IF IF trigger(x + 32, y + 16, x + 63, y + 47, mousex, mousey) OR trigger(x + 96, y + 16, x + 127, y + 47, mousex, mousey) THEN IF lclick = -1 AND ignore` = 0 THEN FOR look% = 0 TO 15 IF storage(0, look%).wep = inmouse.wep THEN switchvar = inmouse inmouse = weapons(plane, 2) storage(0, look%) = weapons(plane, 2) weapons(plane, 2) = switchvar ignore` = -1 EXIT FOR END IF NEXT END IF END IF IF trigger(x, y + 32, x + 31, y + 63, mousex, mousey) OR trigger(x + 128, y + 32, x + 159, y + 63, mousex, mousey) THEN IF lclick = -1 AND ignore` = 0 THEN FOR look% = 0 TO 15 IF storage(0, look%).wep = inmouse.wep THEN switchvar = inmouse inmouse = weapons(plane, 3) storage(0, look%) = weapons(plane, 3) weapons(plane, 3) = switchvar ignore` = -1 EXIT FOR END IF NEXT END IF END IF CASE 9, 10, 11 IF trigger(x + 64, y + 32, x + 95, y + 63, mousex, mousey) AND lclick = -1 AND ignore` = 0 THEN IF weapons(plane, 4).wep = inmouse.wep THEN weapons(plane, 4).ammo = weapons(plane, 4).ammo + inmouse.ammo inmouse = blankspace ELSE switchvar = inmouse inmouse = weapons(plane, 4) weapons(plane, 4) = switchvar END IF ignore` = -1 END IF IF trigger(x + 32, y + 48, x + 63, y + 79, mousex, mousey) OR trigger(x + 96, y + 48, x + 127, y + 79, mousex, mousey) THEN IF lclick = -1 AND ignore` = 0 THEN IF weapons(plane, 5).wep = inmouse.wep THEN weapons(plane, 5).ammo = weapons(plane, 5).ammo + inmouse.ammo inmouse = blankspace ELSE switchvar = inmouse inmouse = weapons(plane, 5) weapons(plane, 5) = switchvar END IF ignore` = -1 END IF END IF END SELECT END SUB SUB changemods (x AS INTEGER, y AS INTEGER, mousex AS INTEGER, mousey AS INTEGER, lclick AS INTEGER, plane AS INTEGER, inmouse AS aug, mods() AS aug) 'Allows the player to change mods on board. DIM switchvar AS aug DIM blankspace AS aug IF trigger(x, y, x + 31, y + 31, mousex, mousey) AND lclick = -1 AND ignore` = 0 THEN IF mods(plane, 1).kind = inmouse.kind AND mods(plane, 1).ammo > 0 THEN mods(plane, 1).ammo = mods(plane, 1).ammo + inmouse.ammo inmouse = blankspace ELSE switchvar = inmouse inmouse = mods(plane, 1) mods(plane, 1) = switchvar END IF ignore` = -1 END IF IF trigger(x + 32, y, x + 63, y + 31, mousex, mousey) AND lclick = -1 AND ignore` = 0 THEN IF mods(plane, 2).kind = inmouse.kind AND mods(plane, 2).ammo > 0 THEN mods(plane, 2).ammo = mods(plane, 2).ammo + inmouse.ammo inmouse = blankspace ELSE switchvar = inmouse inmouse = mods(plane, 2) mods(plane, 2) = switchvar END IF ignore` = -1 END IF IF trigger(x + 64, y, x + 95, y + 31, mousex, mousey) AND lclick = -1 AND ignore` = 0 THEN IF mods(plane, 3).kind = inmouse.kind AND mods(plane, 3).ammo > 0 THEN mods(plane, 3).ammo = mods(plane, 3).ammo + inmouse.ammo inmouse = blankspace ELSE switchvar = inmouse inmouse = mods(plane, 3) mods(plane, 3) = switchvar END IF ignore` = -1 END IF IF trigger(x + 96, y, x + 127, y + 31, mousex, mousey) AND lclick = -1 AND ignore` = 0 THEN IF mods(plane, 4).kind = inmouse.kind AND mods(plane, 4).ammo > 0 THEN mods(plane, 4).ammo = mods(plane, 4).ammo + inmouse.ammo inmouse = blankspace ELSE switchvar = inmouse inmouse = mods(plane, 4) mods(plane, 4) = switchvar END IF ignore` = -1 END IF END SUB SUB aiplane (plane AS INTEGER, planes() AS airplane, weapons() AS weapon, difficulty) 'The other planes' AI angle = planes(plane).dir IF planes(plane).market = 0 THEN distx% = planes(planes(plane).lasthit).x - planes(plane).x disty% = planes(planes(plane).lasthit).y - planes(plane).y totaldist = SQR(distx% ^ 2 + disty% ^ 2) IF difficulty = 1 THEN newposx% = totaldist / 16 * planes(planes(plane).lasthit).speed * COS(planes(planes(plane).lasthit).dir) newposy% = totaldist / 16 * planes(planes(plane).lasthit).speed * SIN(planes(planes(plane).lasthit).dir) distx% = distx% + newposx% disty% = disty% + newposy% planes(plane).force = planes(planes(plane).lasthit).speed + 1 / 256 * (totaldist - 256) IF planes(plane).force > 10 THEN planes(plane).force = 10 IF planes(plane).force < 2 THEN planes(plane).force = 2 END IF IF distx% <> 0 THEN angle2 = ATN(disty% / distx%) ELSE angle2 = 0 IF distx% < 0 THEN angle2 = angle2 + pi IF angle2 < 0 THEN angle2 = angle2 + 2 * pi ELSE SELECT CASE planes(plane).team CASE 0: angle2 = pi CASE 1: angle2 = 0 CASE 2: angle2 = 3 * pi / 2 CASE 3: angle2 = pi / 2 END SELECT END IF IF ABS(angle - angle2) > rad(2) THEN IF angle >= pi THEN IF angle - angle2 < pi AND angle - angle2 > 0 THEN planes(plane).yaw = planes(plane).yaw - .1 ELSE planes(plane).yaw = planes(plane).yaw + .1 END IF IF angle < pi THEN IF angle2 - angle < pi AND angle2 - angle > 0 THEN planes(plane).yaw = planes(plane).yaw + .1 ELSE planes(plane).yaw = planes(plane).yaw - .1 END IF ELSE IF planes(plane).market = 0 THEN IF totaldist <= swidth / 2 - 100 THEN FOR fire% = 1 TO 3 IF weapons(plane, fire%).ifon = -1 THEN IF weapons(plane, fire%).kind = 0 AND weapons(plane, fire%).remaining >= weapons(plane, fire%).total THEN IF weapons(plane, fire%).energy > 0 THEN IF planes(plane).battery > weapons(plane, fire%).energy THEN weapons(plane, fire%).firing = 1: weapons(plane, fire%).remaining = 0 IF weapons(plane, fire%).ammo > 0 THEN IF planes(plane).ammo > 0 THEN weapons(plane, fire%).firing = 1: weapons(plane, fire%).remaining = 0 END IF IF weapons(plane, fire%).kind = 1 AND planes(plane).battery > 1 THEN weapons(plane, fire%).firing = weapons(plane, fire%).firing + 1 END IF NEXT END IF IF INT(RND * 180) = 0 THEN FOR fire% = 4 TO 5 IF weapons(plane, fire%).ifon = -1 THEN IF weapons(plane, fire%).remaining >= weapons(plane, fire%).total THEN weapons(plane, fire%).firing = 1: weapons(plane, fire%).remaining = 0 IF fire% = 5 THEN IF weapons(plane, fire%).remaining = weapons(plane, fire%).total / 2 THEN weapons(plane, fire%).firing = 1 END IF NEXT END IF END IF END IF IF planes(plane).yaw > ABS(deg(angle - angle2)) / 3 THEN planes(plane).yaw = ABS(deg(angle - angle2)) / 3 IF planes(plane).yaw < -(ABS(deg(angle - angle2)) / 3) THEN planes(plane).yaw = -(ABS(deg(angle - angle2)) / 3) IF planes(plane).yaw > 1 THEN planes(plane).yaw = 1 IF planes(plane).yaw < -1 THEN planes(plane).yaw = -1 IF deg(planes(plane).dir) > 359 THEN planes(plane).dir = planes(plane).dir - 2 * pi IF deg(planes(plane).dir) < 0 THEN planes(plane).dir = planes(plane).dir + 2 * pi END SUB SUB fakephysics (force, speed) '"speed"'s relationship to "force" net = force - speed speed = speed + net / 500 END SUB SUB playercontrol (angle, force, yaw, yawcontrol, forcecontrol) 'Allows the player to control pchk's own plane. IF gamepad = 0 THEN IF ignorethrot` = 0 THEN IF _KEYDOWN(119) THEN force = INT(force) + 1: ignorethrot` = -1 IF _KEYDOWN(115) THEN force = INT(force + .9) - 1: ignorethrot` = -1 END IF IF ignorethrot` = -1 AND NOT _KEYDOWN(119) AND NOT _KEYDOWN(115) THEN ignorethrot` = 0 IF _KEYDOWN(97) THEN yaw = -1 ELSEIF _KEYDOWN(100) THEN yaw = 1 ELSE yaw = 0 END IF ELSE force = (-forcecontrol + 1) * 5 IF force < .5 THEN force = 0 IF force > 9.5 THEN force = 10 IF force > 4.5 AND force < 5.5 THEN force = 5 yaw = yawcontrol IF yaw < -.95 THEN yaw = -1 IF yaw > .95 THEN yaw = 1 IF yaw > -.05 AND yaw < .05 THEN yaw = 0 END IF IF force < 0 THEN force = 0 IF force > 10 THEN force = 10 IF deg(angle) > 359 THEN angle = angle - rad(360) IF deg(angle) < 0 THEN angle = angle + rad(360) END SUB SUB playerfire (planes() AS airplane, plane AS INTEGER, weapons() AS weapon, primary AS INTEGER, secondary AS INTEGER) 'Allows the player to fire pchk's own weapons. IF gamepad = 0 THEN DO fire1% = _MOUSEBUTTON(1) fire2% = _MOUSEBUTTON(2) LOOP WHILE _MOUSEINPUT ELSE fire1% = primary fire2% = secondary END IF IF _KEYDOWN(32) OR fire1% AND ignore` = 0 THEN FOR fire% = 1 TO 3 IF weapons(plane, fire%).ifon = -1 THEN IF weapons(plane, fire%).kind = 0 AND weapons(plane, fire%).remaining >= weapons(plane, fire%).total THEN IF weapons(plane, fire%).energy > 0 THEN IF planes(plane).battery > 1 THEN weapons(plane, fire%).firing = 1: weapons(plane, fire%).remaining = 0 IF weapons(plane, fire%).ammo > 0 THEN IF planes(plane).ammo > 0 THEN weapons(plane, fire%).firing = 1: weapons(plane, fire%).remaining = 0 END IF IF weapons(plane, fire%).kind = 1 AND planes(plane).battery > 1 THEN weapons(plane, fire%).firing = weapons(plane, fire%).firing + 1 END IF NEXT END IF IF _KEYDOWN(102) OR fire2% THEN FOR fire% = 4 TO 5 IF weapons(plane, fire%).ifon = -1 THEN IF weapons(plane, fire%).remaining >= weapons(plane, fire%).total THEN weapons(plane, fire%).firing = 1: weapons(plane, fire%).remaining = 0 IF fire% = 5 THEN IF weapons(plane, fire%).remaining = weapons(plane, fire%).total / 2 THEN weapons(plane, fire%).firing = 1 END IF NEXT END IF END SUB SUB toggle (num%, change%, ignoretog%) 'Toggles weapons and mods. "num" is the weapon/mod's place (1-3 for primary weapons, 4-5 for missiles, 6-9 for mods). "change" is "*.ifon". "ignoretog" is like clickonce for toggling. IF _KEYDOWN(num% + 48) AND ignoretog% = 0 THEN IF change% = 0 THEN change% = -1 ELSE change% = 0 ignoretog% = -1 END IF END SUB SUB togglecontrol (plane AS INTEGER, weapons() AS weapon, mods() AS aug, ignoretog%, picked%, pick) 'Allows the player to toggle things. FOR k% = 1 TO 5 toggle k%, weapons(plane, k%).ifon, ignoretog% NEXT FOR l% = 6 TO 9 toggle l%, mods(plane, l% - 5).ifon, ignoretog% NEXT IF gamepad <> 0 THEN IF picked% >= 1 AND picked% <= 5 AND ABS(pick) >= .5 AND ignoretog% = 0 THEN IF weapons(plane, picked%).ifon = 0 THEN weapons(plane, picked%).ifon = -1 ELSE weapons(plane, picked%).ifon = 0 ignoretog% = -1 END IF IF picked% >= 6 AND picked% <= 9 AND ABS(pick) >= .5 AND ignoretog% = 0 THEN IF mods(plane, picked% - 5).ifon = 0 THEN mods(plane, picked% - 5).ifon = -1 ELSE mods(plane, picked% - 5).ifon = 0 ignoretog% = -1 END IF END IF END SUB SUB hudbar (slot AS INTEGER, title$, display, limit, barcolor~&, suffix$, quartz&) 'The simple meter, used for PWR, GEN, etc. 'slot: distance from the top (16 + 32 * slot) 'title: three char title 'display: amount of whatever you are measuring 'limit: the upper limit of whatever you are measuring should be 'barcolor: the color of the meter (dark color recomended) 'suffix: the unit you are using (usually "%") 'quartz: the font IF display < limit THEN LINE (swidth - 167, 16 + 32 * slot + 1)-(swidth - 167 + display / limit * 100, 16 + 32 * slot + 14), barcolor~&, BF ELSE LINE (swidth - 167, 16 + 32 * slot + 1)-(swidth - 67, 16 + 32 * slot + 14), barcolor~&, BF LINE (swidth - 168, 16 + 32 * slot)-(swidth - 66, 16 + 32 * slot + 15), _RGB(255, 255, 255), B IF LEN(title$) > 3 THEN title$ = LEFT$(title$, 3) _FONT quartz& IF display >= limit + 1 THEN COLOR _RGB(255, 127, 0) _PRINTSTRING (swidth - 200, 16 + 32 * slot), title$ + " " + LTRIM$(STR$(INT(display + .5))) + suffix$ COLOR _RGB(255, 255, 255) _FONT 16 END SUB SUB rotator (originx AS INTEGER, originy AS INTEGER, angle, image&, minx%, miny%, maxx%, maxy%, size) 'Makes images that can rotate. DIM rotx(3), roty(3) dist = SQR(((size / 2) ^ 2) + ((size / 2) ^ 2)) rotx(0) = originx + COS(angle + rad(45)) * dist - 1: rotx(1) = originx + COS(angle + rad(135)) * dist - 1: rotx(2) = originx + COS(angle + rad(225)) * dist: rotx(3) = originx + COS(angle + rad(315)) * dist roty(0) = originy + SIN(angle + rad(45)) * dist: roty(1) = originy + SIN(angle + rad(135)) * dist - 1: roty(2) = originy + SIN(angle + rad(225)) * dist - 1: roty(3) = originy + SIN(angle + rad(315)) * dist _MAPTRIANGLE (minx%, miny%)-(minx%, maxy%)-(maxx%, maxy%), image& TO(rotx(3), roty(3))-(rotx(2), roty(2))-(rotx(1), roty(1)) _MAPTRIANGLE _SEAMLESS(minx%, miny%)-(maxx%, miny%)-(maxx%, maxy%), image& TO(rotx(3), roty(3))-(rotx(0), roty(0))-(rotx(1), roty(1)) END SUB FUNCTION getfact$ DIM facts$(7) 'facts$(0) = "The airplane in this game is losely based on the Lockheed-Martin F-35 Lightning II and the General Dynamics F-16 Fighting Falcon, the major difference being the means of propultion." 'facts$(1) = "The premise for 'Electric' was conceived when I discovered this tidbit of information about Lt. Surge from 'Pokemon: Fire Red': 'Lt. Surge is rumored to have been a pilot while home in America. He used the electricity generated by Pokémon to power his plane.' Having said that, the generators in 'Electric' are just normal generators." 'facts$(2) = "'Descent II' by Parallax had a significant influence on 'Electric', which is ironic because 'Electric' has nothing to do with space." facts$(0) = "In most of the code, " + CHR$(34) + "laser" + CHR$(34) + " is misspelled " + CHR$(34) + "lazer." + CHR$(34) facts$(1) = "Change 'Planes per Team' to 2 or more. Shoot your AI helper. Look in the top left corner of the screen. It only appears for 1/60 of a second." facts$(2) = "'Electric v0.1:0001' was just a white triangle that pointed toward the mouse in the center of an 800x600 window." facts$(3) = "There are only 4 fun facts, including this one." 'facts$(6) = "Some of these facts won't make it into the final product due to issues with using the words 'pokemon' and 'Descent II'." getfact$ = facts$(INT(RND * 4)) END FUNCTION