It's somewhat unstructured - I've tried to tidy it up a bit, but I can't promise it'll be tidy enough...
do
allbullet=((sparecount*magazine)+bulletcount+preserved)
if upkey()=1 then move camera 0.5
if downkey()=1 then move camera -0.5
if leftkey()=1 then strafe(-0.5)
if rightkey()=1 then strafe(0.5)
`if leftkey()=1 and scopeon=0 then yrotate camera wrapvalue(camera angle y()+359)
`if leftkey()=1 and scopeon=1 then yrotate camera wrapvalue(camera angle y()+359.90)
`if rightkey()=1 and scopeon=0 then yrotate camera wrapvalue(camera angle y()+1)
`if rightkey()=1 and scopeon=1 then yrotate camera wrapvalue(camera angle y()+0.10)
gosub mousemovement
`gosub bulletpoint
`gosub freebullets
`gosub reloads
`gosub xrecoil
`gosub yrecoil
`gosub fire
`gosub scope
`gosub movebullets
dec nofire
dec reloadwait
if nofire<0
nofire=0
endif
if reloadwait<0
reloadwait=0
endif
if sparecount<0
sparecount=0
endif
if recoilwait>0
dec recoilwait
endif
position listener camera position x(),camera position y(),camera position z()
rotate listener camera angle x(),camera angle y(),camera position z()
gosub hudtext
newcount=timer()
position mouse screen width()/2, screen height()/2
sync
loop
hudtext:
ink rgb(255,255,255),1
set cursor 850,25
print "Bullets: ";
print bulletcount
set cursor 850,45
print "Magazines: ";
print sparecount
set cursor 850,65
print "Unused bullets: ";
print preserved
set cursor 850,85
print "Total bullets: ";
print allbullet
ink rgb(0,127,255),1
circle 517,384,20
return
mousemovement:
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
if scopeon=0 then CameraAngleY# = wrapvalue(CameraAngleY#+mousemovex())
if scopeon=1 then CameraAngleY# = wrapvalue(CameraAngleY#+mousemovex()*0.1)
if scopeon=0 then CameraAngleX# = wrapvalue(CameraAngleX#+mousemovey())
if scopeon=1 then CameraAngleX# = wrapvalue(CameraAngleX#+mousemovey()*0.1)
position camera camera position x(),get ground height(1,camera position x(),camera position z())+10,camera position z()
yrotate camera curveangle(CameraAngleY#,OldCamAngleY#,2.5)
xrotate camera curveangle(CameraAngleX#,OldCamAngleX#,2.5)
return
...maybe one day I'll finish a project
