The Variables, Graphics and Macros


 

;====== Variables & Macros ==================================================
Menu0 db 'Main.pcx', 0 ; filename, terminated with 0 byte
Menu1 db 'Controls.pcx', 0
Menu2 db 'Options.pcx', 0
Menu3 db 'Options.pcx', 0
Menu4 db 'Pause.pcx', 0
Menu6 db 'Win.pcx', 0
Menu9 db 'Menu9.pcx', 0

ErrorMsg db '*** PCX File Not Found ***', '$'
MenuTable1 dw offset Menu0, offset Menu1, offset Menu2, offset Menu3, offset Menu4
dw offset Menu6, offset Menu9

MaxOffset dw ?
MaxOffsetTable dw 12890+4*20*320, 0, 12890+5*20*320, 12890+5*20*320, 12890+3*20*320

MaxOption dw ?
MaxOptionTable dw 4, 0, 5, 5, 3

players PlayerType 6 dup( < > ) ; To hold all players
; Size cut down because we initally
; ran out of segement space
Temp db 0 ; A variable used for transfering data
; and during debugging

OldTimer dd ? ; the address of the old timer handler

TimeOver db 0 ; flag = 1 if 1/36 sec has passed

UseOld db 0 ; is it time to call the original isr?

OldKbdv dd ? ; old keyboard handler

Pause_flag db 0 ; set if escape or pause is pressed

Key_flags db 0 ; like the flags register except sets
; which key was pressed
Flags_copy db 0

Ddx db 0 ; change in x

Ddy db 0 ; change in y

Dangle dw 0 ; change in angle

My_x dw 0 ; my current x
My_y dw 0 ; my current y
My_angle dw 0 ; my angle from 0 deg
My_life db 100 ; my life currently
My_wep db 2 ; how much damage my weapone does
in_reverse db 0 ; 1 moving in reverse
firing db 0 ; 0 = not; 1 = if attacking
att_x dw 0 ; x coordinate of the square i am attacking
att_y dw 0 ; y coordinate " " " "
My_kills db 0 ; number of things i have killed

attackers db 6 dup(0) ; Array of player ids that are attacking me

dead db 0

My_num db 0 ; Who I am (used when player array was larger
; and when we were planning on networking)


gamedone db 0 ; Flag is see if everthing is done


MidiFile0 db 'Hotelcal.xmi',0
MidiFile1 db 'Entn.xmi',0
MidiFile2 db 'Laststar.xmi',0
LowFileSize dw ?
HighFileSize dw 0

sbuf_page db ?
sbuf_offset dw ?
sbuf_length dw 8192 ; 8 k - all that is guaranteed to not
; cross a DMA Page.
finalbuffersize dw ?
mycounter dw -1
needrefill dw 0
loadbuf WaveHdr < >
WavMsg db 'Played wav file in ','$'
CyclesMsg db ' cycles.',13,10,'$'

Wav0 db 'TRANEXPL.wav',0
Wav1 db 'ow.wav',0
Wav2 db 'ow.wav',0
Wav3 db 'REPORT.wav',0
fileno dw ?
wavremaining dd 0
wavlength dd 0
wavdone db 0

 

VIDSEG        EQU 0A000h ; VGA Video Segment Adddress
VIDTEXTSEG     EQU 0B800h ;
SCALE_FACTOR     EQU 20000 ;  constant used for scaling strips in Ray_caster
MAX_INVISIBLES     EQU 8  ;  maximum number of objects to store during a cast
SIZE_INVISIBLE     EQU 12

; these angle constants are used through out the graphics rountines
; and are a simple mapping of the degree angles
ANGLE_0     EQU 0
ANGLE_1     EQU 5
ANGLE_2     EQU 10
ANGLE_4     EQU 20
ANGLE_5     EQU 25
ANGLE_6     EQU 30
ANGLE_15    EQU 80
ANGLE_30    EQU 160
ANGLE_45    EQU 240
ANGLE_60    EQU 320
ANGLE_90    EQU 480
ANGLE_135   EQU 720
ANGLE_180   EQU 960
ANGLE_225   EQU 1200
ANGLE_270   EQU 1440
ANGLE_315   EQU 1680
ANGLE_360   EQU 1920

CELL_X_SIZE EQU 64  ; pixel width of a cell
CELL_Y_SIZE     EQU 64  ; pixel height of a cell
CELL_X_SIZE_FP  EQU 6  ; log base 2 of 64 (used for quick division)
CELL_Y_SIZE_FP  EQU 6  ; log base 2 of 64 (used for quick division)
INTERSECTION_FOUND  EQU 1

;=========== MACROS =====================================


DosExit from Macros.inc


DELA EQU 6
DELX EQU 1
DELY EQU 1
LSIZE EQU 35*4
PLAYERSIZE EQU 14

INACTIVE EQU 23
ATTACKINGA EQU 24
SILENT EQU 25
DEPARTING EQU 26

INCLUDE MACROS.INC

;------------ TWO MORE MACROS FOR DRAWING LINES------------
HORIZONTALline MACRO ; Draw Horizontal line with length of 32 pixels
PUSH DI ; Input: DI = starting point
PUSH CX
MOV CX, 140/4
REP STOSD
POP CX
POP DI
ENDM


VERTICALline MACRO ; Draw vertical line with length of 32 pixels
PUSH DI ; Input: DI = starting point
PUSH CX
mov cx, 20
LoopDown:
mov es:[di], al
add di, 320
Loop LoopDown
POP CX
POP DI
ENDM

 

 

;======== Structures =============================================================


PlayerType STRUC
status db INACTIVE ;what am I doing now, INACTIVE -- dead or off
; SILENT -- active but not attacking
; ATTACKINGA -- active and attacking
imgtype db 4 ; The type of my image
Curx dw 0 ; My current x coordinate
Cury dw 0 ; My current y coordinate
Curangle dw 0 ; The angle that I am facing from 0 deg
Curlife db 20 ; my lifepoints
aimx dw ? ; x coordinate of where I am aiming
aimy dw ? ; y coordinate of where I am aiming
wepdam db 1 ; how much damage my wep does
PlayerType ENDS

UpdateMsg STRUC ; Update Message
condition db INACTIVE ; status of player
LookLike db 0 ; image type
PlayerNum db 0
xpos dw 0 ; My Current x Position
ypos dw 0 ; My Current y Position
viewp dw 0 ; My Current angle
attackx dw 0
attacky dw 0 ; where i am attacking
myweap db 2 ; My weapon damage
mylife db 100 ; My current life
UpdateMsg ENDS


; __Wave Header Struct -- Used for Sound functions____________________
WaveHdr STRUC
format db 'RIFF'
filelen dd ?
wavefmt db 'WAVEfmt_'
fmt_len dd ?
fmt_tag dw ?
channel dw ?
samples dd ?
bytesps dd ?
bkalign dw ?
bitsps dw ?
data db 'data'
datalen dd ?
WaveHdr Ends

 

;========== Segements ========================================================


Soundseg segment stack
Soundbuf db 0FFFFh dup (0)
Soundseg ends

SNDSEG SEGMENT
sndbuf db 2048 dup (10,20,50,80,90,80,50,20) ; 16k of sine wave
SNDSEG ENDS

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

BGSeg segment PUBLIC 'DATA2' ; Wall Textures
Background DB 65535 dup(?)
BGSeg ENDS

ScrSeg segment PUBLIC 'DATA4' ; Used by LoadPCX
Scratchpad DB 65535 dup(?)
ScrSeg ENDS

;====== Stack Segment =====================================================

stkseg segment stack ; *** STACK SEGMENT ***
db 64 dup ('STACK ')
stkseg ends

;====== Define code segment ===============================================

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