Team Members
Introduction
Problem Description 
Screen Shots
Implementation
Procedures
External Routines
Variables and Data Segements
 
 

 TEAM MEMBERS:
 
 

    Mo Hanif:               Sound, Title Screen, Displaying Scores
        Karim Taj:             Game Movement, Networking
    Tim Mathur:          3-D Engine, Networking
     Amit Mathur:        Graphics, AI, Map
 
 
    INTRODUCTION:
 
Our goal was to implement a 3-D, networked, tank game.  The game allows at most 4 human players; each represented as a tank.  Each player has a first person view of the arena (a la Quake).  There will also be one AI controlled tank per human player. The playing field is an arena consisting of an outer wall and several different types of inner walls.  Inner walls can also appear, disappear; move left or right at random. The object of the game is seek out and destroy your opponents, AI or human.  Players get points for destroying tanks.
Scoring is 5 points for the last survivor, 2 points for destroying a human opponent, and 1 pt for destroying a computer AI. When destroyed, that player is out for the duration of the round, but will see an overhead view of the rest of the players until the end of the round. The player with the most points at the end of three rounds is the winner.
 
 

   PROBLEM DESCRIPTION:
 
 
The game’s implementation posed many interesting challenges, which made this project new and unique. For example, the game uses a 3-D engine that gives the player a realistic view of being inside and moving around  3-D world. Previous such tank games have offered a static overhead view of the playing field.  We also faced the challenge of implementing and incorporating sound into the game. In addition, we had to design a competent AI to compete with the human player. A major challenge was putting all our code together and making sure the game flowed as expected.

Our game is also unique in the fact that the player can choose 4 different types of tanks: A standard tank, a tank that moves faster, a tank that reloads and fires faster or a tank that has more armor. Another interesting point is that the game is dynamic; we can create new and more difficult playing arenas by simply creating a new file. (See comments on Load World function.) Finally, this tank game gives players the opportunity to toggle back and forth between a 3-D view and an overhead view.
 

  SCREEN SHOTS:
 

Option Screen
 
Clip of 3_D view
 
Clip of 3_D view
Clip of Overhead Map
Clip of 3_D view
 

IMPLEMENTATION:

The major components are tank structures, bullet structures and game map.  Tank is an array of two tank structures.   Bullet is an array of six bullet structures.  Each player  is responsible for updating there own bullet and tank structures and updating there changes  to the game map.  For Example,  if a player fires a bullet, it must store its direction, distance, position and place it on the game map.  So other player's may see it and must also remove it from the map.
 

 
PROCEDURES:

InitBuf
*Author:          Tim Parker
*Description:    Initializes the ScreenBuffer and the ZBuffer to Black pixels of depth 255
*Inputs:            None
*Outputs:         ScreenBuffer and Zbuffer
*modified from MP4-Z-Buffer

ComputeScale C ViewAngle:word, CScaleDistance:Real4
*Author:          Tim Parker
*Description:   Computes the scale of an object column
*Inputs:            CViewAngle as current viewing angle
                       CScaleDist as current scaling distance
*Outputs:         Scale as proper scale

DrawTanks
*Author:          Tim Parker
*Description:   Draws a scaled tank on the screen
*Inputs:            none
*Outputs:          ZBuffer and ScreenBuffer

GetTankData   GTDist:real4, GTDir:byte
*Author:          Tim Parker
*Description:   Gets data of tank when hit by a ray
*Inputs:           Variables from View3D
*Outputs:         TData

VSky Y1:Word, XOffset:Word, SkyAngle:Word
*Author          Tim Parker
*Description:   Draws a sliver of a pcx file for the sky
*Inputs:           Y1 as lower limit of sky
                       XOffset as X offset on screen
                       SkyAngle  as angle player is facing
*Outputs:        ScreenBuffer

VLine Y1:Word, Y2:Word, Color:Byte
*Author         Tim Parker
*Description:  Places a vertical line of color from Y1 to Y2 at Ray offset on screen
*Inputs:          Y1 as upper limit
                      Y2 as lower limit
                      Color as color to draw (current palette)
*Outputs:        Screenbuffer
                      ZBuffer at depth of 254

TextMap RayLoc:Word, TDistance:Word, TextSegment:Word
*Author         Tim Parker
*Description:  Draws texture map sliver to column specified
*Inputs:          RayLoc as X offset to draw at
                      TDistance as texture distance to draw at
                      TextSegment as Texture Segment to draw from
*Outputs:       ScreenBuffer
*Variables      TextureNumber as Texture Number to draw with
                      TextureCol as Texture column to draw

WallHit  TextNumber:byte, TextDistance:Real4, VonSide:Real4
*Author:         Tim Parker
*Description:  Calls routines to draw sky, wall, and ground
*Inputs:           TextNumber as texture number
                       TextDistance as distance to texture
                       VonSide as Value to Side
*Outputs:         none

View3D
*Author:          Tim Parker
*Description:   Raycasting Routine
*Inputs:           Tank[0], GameMap
*Output:          calls WallHit
*Credits:          Ideas on how a ray caster works taken from the following:
                       Michael Abrash's "Black Book Graphics Programming",
                       LaMothe, Ratcliff, Seminatore & Tyler's "Tricks of the Game Programming Gurus"
                       Plus Kimmo Fredriksson's Ray Casting Engine to further help me understand how ray casting works.
                       Additional code included allowing seeing objects and transparent walls/windows
 
 

DrawText
*Author          Tim Parker
*Description:   Draws text to the screen
                        uses the internal ROM font map at 0F000:0FA6E
*Inputs:            X,Y as location
                       Char as letter to print
                       Color as letter color
                       BKColor as background color
*Outputs:        ScreenBuffer
*NOTE:         Assumes text is at 0 distance, and does not update ZBuffer.

GetRnd LowerV:Word, UpperV:Word
*Author          Tim Parker
*Description:  Generates a random number
*Inputs:           Lower as lower limit
                       Upper as upper limit
*Outputs:         cx as number between Lower and Upper
*NOTE:         uses Timer tick as a randomizer

LoadWorld MapFile:Word
*Author:            Tim Parker
*Description:     loads map of the game into Gamemap segment
                         and decodes ASCII game map into game data
*Inputs:             MapFile: offset of map name
*Outputs:           cx:  0 if load ok, 1 if error
                         Updates Gamemap with decoded data

MoveWalls
*Author:            Tim Parker
*Description:     Moves Walls in Gamemap to create a constantly
                         changing arena.
*Inputs:             WallCounter as updated from timer interrupt
*Outputs:           Updated Gamemap
*Calls:               GetRnd
*Note:              sliding was not completely finished
                         will only move in complete blocks

DispScores
*Author:          Mohammed Hanif
*Description:   displays score after each round
*Input:              none
*Output:           displays updated score on screen

TitleScreen
*Author:          Mohammed Hanif
*Description:    Displays initital screen of game
*Inputs:            none
*Outputs:         Title Screen PCX to screen

PlaySound     SoundVal:word
*Author:          Mohammed Hanif
*Description:  SoundVal is used to reference JumpTable correctly, and Load
                      correct sound file into ScrSeg.  DMA references Scrseg to play sound.
*Inputs:          SoundVal- (1-8) representing sound to be played
*Outputs:        Sound!!
*Note:             Some of the code was taken from ECE291 lectures 22x and 22z
                        Ethan Brodsky's SB16 Programming document
                        Sound files were taken from past ECE291 Projects and Sound Effect CD's

InsTimer
*Author:        Mohammed Hanif with reference to MP3
*Description:  Contrls pace of game through timer Interrupts
*Inputs:           none
*Outputs:         OldTimerV
 

DeInstTimer
*Author:           Mohammed Hanif, with reference to MP3
*Description:    Controls pace of game and reconfigures the timer chip
*Inputs:              OldTimerV
*Outputs:             none
 

MyTimerHandler
*Author:            Mohammed Hanif, with reference to MP3
*Description:      controls pace of game and sends ACK and END of Interrupt
*Inputs:                TimerCount
*Outputs:              TimerCount

InstKey
*Author:            Mohammed Hanif, with reference to MP3
*Description:     Grabs game control commands from the keyboard
                         Saves default interrupt vector in OldKeyV
*Inputs:              None
*Outputs:          OldKeyV
 

DeInstKey
*Author:            Mohammed Hanif, with reference to MP3
*Description:      Grabs control of game form the keyboard
*Inputs:               OldKeyV
*Outputs:             None
 

MyKeyHandler
*Author:            Mohammed Hanif--_MP4 function
*Description::     Grabs control command from keyboard and sets appropriate keys
*Inputs:              None
*Outputs:           Escpressed, SpcPresssed, TabPressed, UpPressed, DownPressed, RightPressed, LeftPressed
 

ModeGraph
*MP4 function
*Description:      vBIOS call to switch into text-mode video w/50 lines
 
DrawScreen
*MP4 function
*Description:     Places the contents of ScreenBuffer into Video RAM
*Inputs:             None
*Outputs:          Video RAM

DrawPCX
*Description:    Draws PCX file to the screen
*Inputs:            VSeg as segment to draw
*Outputs:         Video RAM
*NOTE:           Used for debugging purposes only!

GetGameMap
* Author:          Karim Taj
* Description:   GameVal is set to the value at the position in the Map
*Inputs:            x and y coordinates
*Outputs:         GameVal

SetGameMap
*Author:          Karim Taj
*Description:    Sets the space on the GameMap at the x and y coordinates with setval
*Inputs:            x and y coordinates, and setval
*Outputs:         GameMap

PCheckPos
* Author:         Karim Taj
*Description:   Checks if the Human Player is at the given coordinates, sets CX  to a 1 if it is.
*Inputs:            x and y coordinates
*Outputs:         CX
 

AICheckPos
*Author:          Karim Taj
*Description:   Checks if the AI Player is at the given coordinates, sets CX  to a 1 if it is.
*Inputs:            x and y coordinates
*Outpus:          CX
 
====================== Network Functions =============================
 
 

SendQue
*Author:          Karim Taj
*Description:   Sets up TX Buffer as follows
           0 = MType
                   1 = MapUpdate
                   2 = Check Player Hit
                   3 = Check AI Hit
                   4 = PlaySound
           1 = MapObject (0 - 37 are map objects)
           2 = SoundObject (1-6)
           3 = x
           4 = y
           5 = oldx
           6 = oldy
           7 = Player Number
           8 = Round Number
 *Inputs: all the inputs of the buffer
 *Outputs: sends message over network
 

SendSound
*Author:           Karim Taj
*Description:    Network Function
*Inputs:            Soundtype and x and y coordinates
*Outputs:          Sends message to Network
*Calls:              SendQue

SendHit
*Author:           Karim Taj
*Description:    Network Function
*Inputs:             x and y coordinates
*Outputs:          sends message to Network
*Calls:              SendQue

SendAIHit
*Author:           Karim Taj
*Description:    Network Function
*Inputs:            x and y coordinates
*Outputs:         sends message on Network
*Calls:              SendQue

SendUpMap
*Author:           Karim Taj
*Description:    Network Function
*Inputs:            x and y coordinates, oldx and oldy, and object
*Outputs:         Sends message on Network
*Calls:              SendQue

NetUpdate
*Author:           Karim Taj
*Description:     Reads the RX buffer correctly and makes the appropriate changes
                         to the game map and tank structures, also plays sounds
*Inputs:             RXBuffer
*Outputs:          Numerous
 
UpdatePlayer
*Author:            Karim Taj
*Description:     Reads the keystroke variables and alters the position and
                         direction of the tank accordingly, does nothing to the Map.
*Inputs:             Variables set by key handler
*Outputs:          Tank variables: oldx, oldy, x, y, dir
 
UpdateBullets:
*Author:             Karim Taj
*Description:      Fires and increments the bullets
*Inputs:              Spacepressed
*Outputs:            None

InitPlayer
*Author:         Karim Taj
*Description:   Simply places the player on the Game Map and records the position
*Inputs:           None
*Outputs:        Sets player to random position on map.

InitAI
*Author:          Karim Taj
*Description:   Places the AI on the Game Map and records the position
*Inputs:           None
*Outputs:        Sets AI  to random position on map.

UpDateMap
*Author:           Karim Taj
*Description:    This function checks if all the moves made by the Tanks and the bullets
                        are valid and displays the changes on the map. It also plays sounds for collisions.
    Functionality:
        Moves the bullets to their new positions and:
                1.  If a bullet runs into a wall, play a certain sound.
                2.  If a bullet runs into a tank
                        -  Play a certain sound
                        -  Increment score
                        -  Send a packet to the tank being hit to decrement
                           their score and to play a sound
                        -  Remove the bullet from the map
        Once all the bullets are moved, move the tank to its new position and:
                1.  If the tank runs into a wall, play a certain sound
                2.  If the tank runs into a another tank
                        -  Play a certain sound
                        -  Send a packet to the tank being run into to
                           play a sound
*Inputs:              Tank and Bullet Structures
*Outputs:           Writes to GameMap
 
DrPoint
*Author:             Karim Taj,  derived from MP4's DrawPoint
*Description:       Colors one pixel on screen
*Inputs:               x and y coordinates and color
*Outputs:            To screen
 
InitScreen
* MP4 function

UpdateStatBar
*Author:              Karim Taj
*Descriptions:      Displays 320*20 status bar at bottom of screen
*Inputs:               Round, player score, armor, #of players
*Outputs:             To screen
 
DrawSight
*Author:               Karim Taj
*Description:        displays 10*10 pixel PCX sight to center of screen
*Inputs:                PCX image
*Outputs:             Screen
 
OptionsScreen
*Author:             Karim Taj
*Descriptions:     sets the players life, tankspeed, and bulletspeed
*Inputs:               None
*Outputs:            gamelife, gameTSpeed, gameBSpeed
 
UpdateAI
*Author:              Karim Taj/Amit Mathur
*Description:        Alters the position and direction of the AI tank according to
                            the inputted direction, does nothing to the Map.
*Inputs:                Variables set by key handler
*Outputs:             Tank variables: oldx, oldy, x, y, dir
 
TankAI
*Author:              Amit Mathur
*Descripton:        Uses a FindHuman which is a PlayerStruct that contains the
                             X and Y coord of all human players in the game.
                             Calculates which human player is closest to it.
                             Calculates the viewangle of that player and turns
                              its toward, firing and moving
*Inputs:                 None
*Outputs:              An AI opponent
 
OverheadMap
*Author:               Amit Mathur
*Description:        Draws an overheadmap to the screen showing players and walls
*Inputs:                None
*Outputs:             Overhead Map to VidSeg
 
DrawMapElement
*Author:              Amit Mathur
*Inputs:                si = offset into MapSeg
                            di = offset to VidSeg
*Outputs: draws a 4*4 block to the screen
*Helper function used in OverheadMap

Scroll
*Author:               Amit Mathur
*Description:        Helper function for Credits Screen.
*Inputs:                Pcx file
*Output:               Outputs "scrolling" lines to screen.

CreditsScreen
*Author:               Amit Mathur
*Description:        Displays authors and their main tasks
*Inputs:                 None
*Outputs:              GameOver and Credits to screen

Controls
*Author:                Amit Mathur
*Description:         Displays contols screen
*Inputs:                  None
*Outputs                Pcx file to screen.
 
 

 
EXTERNAL ROUTINES
 

extrn LibLoadPCX:near  (MP4)
extrn kbdin:near                   ; LIB291 routines are always Free
extrn dspmsg:far                  ; LIB291 routine
extrn rsave:near
extrn dspout:far
extrn rrest:near
extrn dosxit:near
extrn NetInit:far
extrn SendPacket:far
extrn NetRelease:far
extrn NetTest:far
extrn TXBuffer:byte
extrn RXBuffer:byte

VARIABLES AND DATA SEGMENTS
;====== Constants =========================================================

VIDSEG                        EQU     0A000h      ; VGA Video Segment Adddress
VIDTEXTSEG             EQU     0B800h
CR                                 EQU     13
LF                                 EQU     10
MAX_DIST                EQU     50
FORWARD                 EQU     0
BACKWARD             EQU     1
RIGHT                          EQU     2
LEFT                             EQU     3
GRIDSIZE_X               EQU     80
GRIDSIZE_Y                EQU     50
PUP                               EQU     72  ;"8" on the num pad
PDOWN                       EQU     80  ;"2" on the num pad
PRIGHT                        EQU     77  ;"6" on the num pad
PLEFT                           EQU     75  ;"4" on the num pad
VIEWBOTTOM          EQU     180
ANGLE0                       EQU     0
ANGLE6                       EQU     30
ANGLE30                     EQU     160
ANGLE45                      EQU     240
ANGLE90                      EQU     480
ANGLE180                    EQU     960
ANGLE270                    EQU     1440
ANGLE360                    EQU     1920
CELL_SIZE                   EQU     64
MIN_DIST                   EQU     50
MaxX                             EQU     GRIDSIZE_X * CELL_SIZE - Min_dist
MaxY                             EQU     GRIDSIZE_Y * CELL_SIZE - Min_dist
MaxWalls                     EQU     -1
SCREEN_BOTTOM    EQU     0E100h
BASEADDR                 EQU     0220h       ;SoundBlaster base address
IRQ7                               EQU     13          ;SoundBlaster IRQ
DMAchannel                EQU     1           ;SoundBlaster DMA channel

; PIC MASKS FOR MASK/DEMASK IRQ
PICANDMASK            EQU     11011111b   ;'AND' PIC mask for clear IRQ7
PICORMASK               EQU     00100000b   ;'OR' PIC mask for set IRQ7

; DMA CONTROLLER REGISTERS :
WRITEMASK              EQU     00Ah        ;WRITE MASK REGISTER
WRITEMODE               EQU     00Bh         ;WRITE MODE REGISTER
CLEARFLIPFLOP         EQU     00Ch
PAGE_CHN                   EQU     083h         ;PAGE REGISTER FOR DMAchannel 1
BASE_CHN                   EQU     002h         ;BASEADDRESS REGISTER DMAchannel 1
COUNT_CHN               EQU     003h         ;COUNT REGISTER DMAchannel 1
; SAMPLERATE : (if you change it pay attention to maximum samplerate)
TIMECONST                EQU     166          ; = 10989 Hz (256-1000000/11000)

; DMA WRITE MODE
WANTEDMODE          EQU     48h    ; singlemode, autoinit, readmode
;**********************************************************************
WAIT_TIME                 EQU     000FFh
DSP_INTRQ_CMD       EQU     000F2h
 

; ==================== MACROS ====================
WAITWRITE MACRO
local     busy
          mov dx, 220h
          add dl, 0ch
busy:
          in al, dx
          or al, al
          js busy
 
ENDM
 

;====== Segments ==========================================================
PUBLIC PanelMap, Scratchpad, NETUPDATE, FontMap
PUBLIC LoadPCX, ScreenBuffer, ZBuffer

SBSeg segment 'DATA1'
    ScreenBuffer DB 65535 dup(?)
SBSeg ENDS

ZBSeg segment 'DATA2'
    ZBuffer DB 65535 dup (?)
ZBSeg ENDS

WallSeg segment 'DATA3'
    Wallmap DB 65535 dup (?)
WallSeg ENDS

ScrSeg segment 'DATA4'
    Scratchpad DB 65535 dup (?)
ScrSeg ENDS

MapSeg segment 'DATA5' ; game map
        Gamemap DB 4200 dup (?)
MapSeg ENDS
 
Skyseg segment 'DATA6' ; Sky pcx
        Skymap  db  65535  dup (?)
Skyseg ends

TankSeg segment 'DATA7' ; tank pics
        Tankpics db 65535 dup (?)
TankSeg ends

PanelSeg segment 'DATA8'
        PanelMap db 65535 dup(?)
PanelSeg ends

stkseg  segment stack                   ; *** STACK SEGMENT ***
        db      128 dup ('STACK   ')     ; 128*8 = 1024 Bytes of Stack
stkseg  ends
 
 

LibDrawPoint        PROTO near C X:word, Y:word, Z:word, Color:byte
ModeGraph           PROTO near C    ; Switch video mode to graphics (Given)
ModeText              PROTO near C    ; Switch video mode to text (Given)
DrawScreen           PROTO near C    ; Transfer ZBuffer contents to VRAM
DrawPoint              PROTO near C X:word, Y:word, Z:byte, Color:byte

 Tim's PROTOS
InitBuf                     PROTO near C
ComputeScale        PROTO near C  CViewAngle:word, CScaleDistance:Real4
DrawTankSliver     PROTO near C  XLoc:Word, TDist:Word, TCol:word
DrawTanks             PROTO near C
GetTankData          PROTO near C  GTDist:real4, GTDir:byte
VSky                        PROTO near C  Y1:Word, XOffset:Word, SkyAngle:Word
VLine                       PROTO near C  Y1:Word, Y2:Word, Color:Byte
TextMap                 PROTO near C  RayLoc:Word, TDistance:Word, TextSegment:Word
WallHit                   PROTO near C  TextNumber:byte, TextDistance:Real4, VonSide:Real4
View3D                   PROTO near C
InitBuf                     PROTO near C
ComputeScale        PROTO near C CViewAngle:word, CScaleDistance:Real4
GetRnd                    PROTO near C LowerV:Word, UpperV:Word
DrawText                PROTO near C X:word, Y:word, Char:byte, Color:byte, BKColor:byte
LoadWorld             PROTO near C MapFile:Word
SetGameMap          PROTO near C x:byte, y:byte, setval:byte
GetGameMap          PROTO near C x:byte, y:byte
MoveWall               PROTO near C
 
 
 

 

cseg    segment public 'CODE'
        assume  cs:cseg, ds:cseg, ss:stkseg, es:nothing

FontFile        db      'letters.pcx',0   ; Filename of PCX file with font images
PanelFile       db      'Map.pcx',0
Sound1          db      'babym1.wav',0
Sound2          db      'explbig1.voc',0    ;intial hit
Sound3          db      'explos~1.wav',0
Sound4          db      'move2.wav',0    ;tank moving
Sound5          db      'tankcol1.voc',0    ;tanks colliding
Sound6          db      'wall_1.wav',0
Sound7          db      'int1.wav',0
Sound8          db      'intro_2.wav',0
Round1          db      'Round1.dat', 0
Round2          db      'Round2.dat',0
Round3          db      'Round3.dat', 0
Credits1         db      'Credits1.pcx',0
Credits2         db      'Credits2.pcx',0
GameOver     db      ' gameover.pcx',0
TitleFile          db      'TitleFile.pcx',0
ScoreFile       db       'scores.pcx',0
RoundLoad    db      'nextrnd.pcx',0
ControlFile     db      'controls.pcx',0

====================== VARIABLES==================
public fontfile, letters
 

; Jumptable into Map.pcx
JMap1           db      76      ;blackspace         '0'
                      db      64      ;red outside wall   '1'
                      db      68      ;grey inside wall   '2'
                      db      68      ;grey inside wall   '3'
                      db      68      ;grey inside wall   '4'
                      db      68      ;grey inside wall   '5'
                      db      68      ;grey inside wall   '6'
                      db      68      ;grey inside wall   '7'
                      db      68      ;grey inside wall   '8'
                      db      68      ;grey inside wall   '9'
                      db      (4*0)   ;green N            '10'
                      db      (4*1)   ;green NE           '11'
                      db      (4*2)   ;green E            '12'
                      db      (4*3)   ;green SE           '13'
                      db      (4*4)   ;green S            '14'
                      db      (4*5)   ;green SW           '15'
                      db      (4*6)   ;green W            '16'
                      db      (4*7)   ;green NW           '17'
                      db      76      ;nothing '18'
                      db      76      ;nothing '19'
                      db      (4*0)   ;AI green N            '20'
                      db      (4*1)   ;AI green NE           '21'
                      db      (4*2)   ;AI green E            '22'
                      db      (4*3)   ;AI green SE           '23'
                      db      (4*4)   ;AI green S            '24'
                      db      (4*5)   ;AI green SW           '25'
                      db      (4*6)   ;AI green W            '26'
                      db      (4*7)   ;AI green NW           '27'
                      db      64      ;red bullet/wall
 

;JMap2 gives the offset into the PCX file based on the tank dir of your tank.
;It gives you the offset of a blue tank.
JMap2           db      32      ;blue N
                      db      36      ;blue NE
                      db      40      ;blue E
                      db      44      ;blue SE
                      db      48      ;blue S
                      db      52      ;blue SW
                      db      56      ;blue W
                      db      60      ;blue NW
 

;Tanks is a 320*128 PCX file containing 8 tank views, deadtank, sight, and shell
;PIC0   PIC1    PIC2    PIC3    PIC4
;PIC5   PIC6    PIC7    PIC8    p9 p10
;PIC 0-8 are 64*64
;p9 and p10 are 20*20
;JTank is a jump table that gives the offset into Tanks.PCX
JTanks          dw      0       ;PIC0
                     dw      64      ;PIC1
                     dw      128     ;PIC2
                     dw      192     ;PIC3
                     dw      256     ;PIC4
                     dw      (320*64) + (64*0)       ;PIC5
                     dw      (320*64) + (64*1)       ;PIC6
                     dw      (320*64) + (64*2)       ;PIC7
                     dw      (320*64) + (64*3)       ;PIC8
                     dw      (320*64) + (64*4)       ;sight(p9)
                     dw      (320*64) + (64*4) + 44  ;shell(p10)

;Walls is a 320*128 PCX file that has 4 sets of walls
;W0 W1  W2  W3  W?
;W4 W5  W6  W7  W?
;Each wall is 64*64
;W0/W1 are the outside red walls
;W2/W3 are the inside grey walls
;W4/5  are the broken brick red "random"
;W6/7  are red "random" walls.

;JWalls is a jump table that gives the offset of the walls
JWalls          dw      0
                    dw      64
                    dw      128
                    dw      192
                    dw      (320*64) + (64*0)
                    dw      (320*64) + (64*1)
                    dw      (320*64) + (64*2)
                    dw      (320*64) + (64*3)

WallDatastruct STRUCT
        WDX                 db      ?
        WDY                 db      ?
        WDHeight          db      ?
        WDDir               db      ?
WallDatastruct ends

; Structure for tanks
TankStruct STRUCT
        life                      db      ?
        bulletspeed         db      ?
        tankspeed          db      ?
        x                        db      ?     ; 0-79
        y                        db      ?     ; 0-49
        dir                      db      ?
        score                  db      ?
        status                  db      ?
        oldx                   db      ?     ; 0-79
        oldy                    db      ?     ; 0-49
        viewangle           dw      ?
        viewx                 dw      ?     ; 0-64*79
        viewy                 dw      ?     ; 0-64*49
        oldviewagle         dw      ?     ; 0-1920
        oldviewx             dw      ?     ; 0-64*79
        oldviewy             dw      ?     ; 0-64*49
TankStruct ends

BulletStruct STRUCT
        active                  db      ?
        x                         db      ?     ; 0-79
        y                         db      ?     ; 0-49
        dir                       db      ?
        distance               dw      ?
        oldx                     db      ?     ; 0-79
        oldy                     db      ?     ; 0-49
        viewx                   dw      ?     ; 0-64*79
        viewy                   dw      ?     ; 0-64*79
        viewangle             dw      ?     ; 0-1920
BulletStruct ends

; Used by AI
HumanStruct     struct
        X                       dw      ?
        Y                       dw      ?
HumanStruct ends

; Used by AI
PlayersStruct   struct
        H1      HumanStruct     <?,?>
        H2      HumanStruct     <?,?>
        H3      HumanStruct     <?,?>
        H4      HumanStruct     <?,?>
PlayersStruct ends
 

FindHuman       PlayersStruct   <<255,255>,<255,255>,<255,255>,<255,255>>
Tank                 TankStruct      2 dup (<?,?,?,?,?,?,?,?,?,?>)
Bullet                BulletStruct    6 dup (<?>)

oldTimerv                   dd      ?
oldKeyV                     dd      ?
p1KeyDir                    db      ?
count                           db      ?
TimerCountP                db      0
TimerCountAI             db      0
MyNum                       db      63
Var_CELL_SIZE        dw      CELL_SIZE               ;used for loading FPU
upPressed                    db      0
downPressed                db      0
leftPressed                    db      0
rightPressed                  db      0
escPressed                    db      0
spacepressed                db      0
tabPressed                    db      0
resetPressed                  db      0
AiFire                            db      0
speedcounter                 db      ?
Kdeltax                         dw      ?
Kdeltay                         dw      ?
BullCkDir                      db      ?
TempCoordX                db      ?
TempCoordY                db      ?
TempVar                       dw      ?
TempRealConst             Real4   6.28
GameVal                        db      ?
Round                           db      ?
PCount                          db      ?
AICount                         db      ?
XSubCell                        dw      0
YSubCell                        dw      0
Float180                        Real4   180.0
Real3272                       Real8   0.0032724923
Real03272                     Real8   0.00032724923
TempReal                      Real4   ?
TempReal2                    Real4   ?
CellX                             dw      ?
CellY                              dw      ?
WX                                dw      ?
WY                                dw      ?
XonHorizontal                Real4   ?
YonVertical                    Real4   ?
DistTOHorizontal            Real4   ?
DistTOVertical                Real4   ?
TempWord                     dw      ?    ;used for loading FPU with const and registers
VAngle                            dw      ?
TempHorizontal                dw      ?
TempHorizontal1              dw      ?
TempVertical                    dw      ?
TempVertical1                  dw      ?
DiffTOHorizontal              dw      ?
DiffTOHorizontal1             dw      ?
DiffTOVertical                   dw      ?
DiffTOVertical1                 dw      ?
Horizontal                          dw      ?
NextHorizontal                   dw      ?
NextY                                dw      ?
Vertical                               dw      ?
NextVertical                        dw      ?
NextX                                 dw      ?
Ray                                      dw      ?
LowerEnd                            dw      ?
UpperEnd                            dw      ?
TextureNumberHorz             db      ?
TextureNumberVert              db      ?
Scale                                    dw      ?
TextureNumber                     db      ?
TextureColumn                     dw      ?

; AI Variables
humanX                                dw      ?
humanY                                dw      ?
humanDIST                          dw      0ffffh
tempclosest                           db      ? ; 1-4
tempdist                                dw      ?
AIx                                       dw      ?
AIy                                       dw ?
AIviewangle                          dw ?
distx                                     dw ?
disty                                     dw ?
degreeconst                           Real4 5.33333
Theta                                     dw ?
destangle                               dw ?
 
; SB variables
SbIrq                                     dw      13
sbint                                       dw      220

gamelife                                  db      ?
gameBSpeed                          db      ?
gameTSpeed                          db      ?
FontMap                                dw      ?
File                                         dw      ?
delayvar1                                dd      ?
delayvar2                                 dd      ?
sound                                      dw      ?
part                                          db      1
OLDInterruptSEG                   dw      ?
OLDInterruptOFS                   dw      ?
DMAbufferOFS                      dw      ?
DMAbufferPage                       db      ?
filesize                                      dw      ?
var                                           dw      ?
 

* Intro, Options, Loading, Scores and GameOver  images taken form these sites:
a) Armored Fighting Images
http://sorex.tvi.cc.nm.us/~rhernand/tanks.html
b) British Army Equipment
http://www.army-mod.uk/army/equip/index.html
c)  ADVA Army Awards
http://www.servtech.com/amenical/awards/#dodsrcmedals