DECLARE SUB doevents ()
DECLARE SUB changetime ()
DECLARE SUB drawroofs ()
DECLARE SUB drawbullets ()
DECLARE SUB radiomenu ()
DECLARE SUB center (y%, tekst$, kleur%)
DECLARE SUB handlebuy ()
DECLARE SUB drawhud ()
DECLARE SUB loadmap (file$, comment%)
DECLARE SUB drawplayer ()
DECLARE SUB resetall ()
DECLARE SUB drawitems ()
DECLARE SUB drawscreen ()
DECLARE SUB initializegame ()
' Second rewrite of Engine
' Problems:
' Collision
' Better and faster drawing
'$INCLUDE: 'directqb.bi'
'$DYNAMIC
DEFINT A-Z
COMMON SHARED MX, MY, PMX, PMY, message$, messagecounter, messubt
COMMON SHARED playerx, playery, PlayerHealth, PlayerWeapon, PlayerFrame, PlayerFacing, playercell, PlayerAmmo, PlayerMoney, PlayerArmor, PlayerWeaponCount, PlayerWeaponDelay, PlayerMaxAmmo, PlayerMaxCardrige, PlayerUsedCardrige, PlayerReloads,  _
PlayerStepCounter, PlayerWalkDelay, PlayerReload, PlayerScore, PlayerKills, PlayerDeaths, Playername$
COMMON SHARED blocked, walkit, onsteal, PlayerOutside, seconds, minutes
COMMON SHARED fade, fadeway, MaxMY, corx, cory, tijd, n$, freezetime, roundtime

COMMON SHARED maptile(), mapcol(), mapitems(), mapplayers(), plmask(), plsprite(), bulletd(), bulletx!(), bullety!(), bulletdx!(), bulletdy!(), bullets(), blmask(), mapways(), rway(), eway(), chatline$(), chatlines$(), unitname$(), bulleta!(),  _
bullets2()
COMMON SHARED unitd(), unith(), unita(), unitac(), unitt(), unitx(), unity(), unitl(), unitf(), unitf2(), unitc(), unitmc(), bulleto(), unitm(), uniti1(), uniti2(), uniti3(), uniti4(), unitam(), unitpmc(), uniti5(), uniti6(), uniti7(), unitr(),  _
unitw(), unitrw(), unitway(), unitfollow(), unitki(), unitds(), unitping()
RANDOMIZE TIMER


DIM SHARED maptile(4095)        'Tilenr
DIM SHARED mapcol(4095)         'Occupied? (for AI)
DIM SHARED mapitems(4095)       'Items
DIM SHARED mapplayers(4095)     'Which player is on which cell?
DIM SHARED mapways(4095)        'Waypoints for bots

DIM SHARED pal AS STRING * 786
DIM SHARED plmask(48), plsprite(288), blmask(4)

DIM SHARED bulleta!(300) 'Angle
DIM SHARED bulleto(300) ' Who owns the bullet?
DIM SHARED bulletd(300) 'Dead flag
DIM SHARED bulletx!(300) 'x
DIM SHARED bullety!(300) 'x
DIM SHARED bulletdx!(300)'Increasement x
DIM SHARED bulletdy!(300)'Increasement y
DIM SHARED bullets(300) 'Bullet strength
DIM SHARED bullets2(300) 'Bullet Speed

DIM SHARED unitam(30)   ' Ammo!
DIM SHARED unitd(30)    ' 16 players and 14 Hostages at max)
DIM SHARED unith(30)    ' Health
DIM SHARED unitc(30)    ' Cell
DIM SHARED unitx(30)    ' Cell + X
DIM SHARED unity(30)    ' Cell + Y
DIM SHARED unita(30)    ' Armor
DIM SHARED unitac(30)   ' Action
                        ' 0 = Seek and Destroy or defuse bomb / lay bomb
                        ' 1 = Follow / Cover Leader
                        ' 2 = Sleep (Hostages)
DIM SHARED unitl(30)    ' Leader? 0 = NO, 1 = YES
DIM SHARED unitf(30)    ' Facing (for moving and attacking)
DIM SHARED unitf2(30)   ' Frame
DIM SHARED unitmc(30)   ' Move cell (for moving only)
DIM SHARED unitm(30)    ' Money of player...
DIM SHARED uniti1(30)   ' Timer 1 = For reload
DIM SHARED uniti2(30)   ' Timer 2 = For Walking
DIM SHARED uniti3(30)   ' Timer 3 = For shooting
DIM SHARED uniti4(30)   ' Timer 4 = For Buying
DIM SHARED unitw(30)    ' Weapon its carying
                        ' 0 = Nothing
                        ' 1 = Minigun
                        ' 2 = Rifle
                        ' 3 = Sniper
                        ' 4 = Shotgun
DIM SHARED unitpmc(30)  ' Previous Movecell, so we don't move back and forth
DIM SHARED uniti5(30)   ' New counter for roaming
DIM SHARED uniti6(30)   ' New counter for roaming
DIM SHARED uniti7(30)   ' New counter for roaming (attack during)
DIM SHARED unitfollow(30) ' Will the unit follow? When -1 then NOT when > -1 then follow
                          'the current ID, but the ID = 0 means player!

DIM SHARED unitki(30)   ' Kills
DIM SHARED unitds(30)   ' Deaths

'Unit waypoint controls

DIM SHARED unitr(30)    ' Route NR it follows
DIM SHARED unitrw(30)   ' Route NR WAYPOINT it is currently on
DIM SHARED unitway(30)  ' 0 means from 0-end | <> 0 means from end-0

'ROUTES
'ROUTE NR, CELL
DIM SHARED rway(40, 40) '40 routes, 40 waypoints (each route 40 ways)

'Units Info
' INDEX 0 = PLAYER!
' INDEX 6 = LEADER T
' INDEX 16 = HOSTAGE and so forth

DIM SHARED unitname$(30) ' The NAME of our bot!
DIM SHARED item$(10), itemp(10)
DIM SHARED chatline$(5), chatlines$(30)
i = 0
OPEN "chatline.dat" FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, chatlines$(i)
i = i + 1
LOOP
CLOSE #1

'Misc things
DIM SHARED unitping(30) ' Visual Pings

