
SFX_NAMES:
 dc.l ScreamName,4400
 dc.l ShootName,7200
 dc.l MunchName,5400
 dc.l PooGunName,4600
 dc.l CollectName,3400
;5
 dc.l DoorNoiseName,8400
 dc.l BassName,8000
 dc.l StompName,4000
 dc.l LowScreamName,8600
 dc.l BaddieGunName,6200
;10
; dc.l 0,0
 dc.l SwitchNoiseName,1200
 dc.l ReloadName,4000
 dc.l NoAmmoName,2200
 dc.l SplotchName,3000
 dc.l SplatPopName,5600
;15 
 dc.l BoomName,11600
 dc.l HissName,7200
 dc.l Howl1Name,7400
 dc.l Howl2Name,9200
 dc.l PantName,5000
;20
 dc.l WhooshName,4000
 dc.l ShotGunName,8800
; dc.l 0,0
 dc.l FlameName,9000
 dc.l MuffledName,1800
 dc.l ClopName,3400
;25 
 dc.l ClankName,1600
 dc.l TeleportName,11000
 dc.l HALFWORMPAINNAME,8400
 dc.l -1
 
ShotGunName:	dc.b 'AB3D2:sounds/shotgun',0
 even 
ScreamName:	dc.b 'AB3D2:sounds/scream',0
 even
LowScreamName:	dc.b 'AB3D2:sounds/lowscream',0
 even
BaddieGunName:	dc.b 'AB3D2:sounds/baddiegun',0
 even
BassName:	dc.b 'AB3D2:sounds/splash',0
 even
ShootName:	dc.b 'AB3D2:sounds/fire!',0
 even
MunchName:	dc.b 'AB3D2:sounds/munch',0
 even
PooGunName:	dc.b 'AB3D2:sounds/shoot.dm',0
 even
CollectName:	dc.b 'AB3D2:sounds/collect',0
 even
DoorNoiseName:	dc.b 'AB3D2:sounds/newdoor',0
 even
StompName:	dc.b 'AB3D2:sounds/footstep3',0
 even
SwitchNoiseName:dc.b 'AB3D2:sounds/switch',0
 even
ReloadName:	dc.b 'AB3D2:sounds/switch1.sfx',0
 even
NoAmmoName:	dc.b 'AB3D2:sounds/noammo',0
 even
SplotchName:	dc.b 'AB3D2:sounds/splotch',0
 even
SplatPopName:	dc.b 'AB3D2:sounds/splatpop',0
 even
BoomName:	dc.b 'AB3D2:sounds/boom',0
 even
HissName:	dc.b 'AB3D2:sounds/newhiss',0
 even
Howl1Name:	dc.b 'AB3D2:sounds/howl1',0
 even
Howl2Name:	dc.b 'AB3D2:sounds/howl2',0
 even
PantName:	dc.b 'AB3D2:sounds/pant',0
 even
WhooshName:	dc.b 'AB3D2:sounds/whoosh',0
 even
RoarName:	dc.b 'AB3D2:sounds/bigscream',0
 even
FlameName:	dc.b 'AB3D2:sounds/flame',0 
 even
MuffledName:	dc.b 'AB3D2:sounds/MuffledFoot',0
 even
ClopName:	dc.b 'AB3D2:sounds/footclop',0
 even
ClankName:	dc.b 'AB3D2:sounds/footclank',0
 even
TeleportName:	dc.b 'AB3D2:sounds/teleport',0
 even
HALFWORMPAINNAME: dc.b 'AB3D2:sounds/HALFWORMPAIN',0
 even
 
;-102
;7c
 
OBJ_NAMES:
 dc.l wad1n
 dc.l ptr1n
 
 dc.l wad2n
 dc.l ptr2n
 
; dc.l wad3n
; dc.l ptr3n
 
 dc.l wad4n
 dc.l ptr4n
 
 dc.l wad5n
 dc.l ptr5n
 
 dc.l wad6n
 dc.l ptr6n
 
 dc.l wad7n
 dc.l ptr7n
 
 dc.l wad8n
 dc.l ptr8n
 
 dc.l wad9n
 dc.l ptr9n
 
 dc.l wadan
 dc.l ptran
 
 dc.l wadbn
 dc.l ptrbn
 
 dc.l wadcn
 dc.l ptrcn
 
 dc.l waddn
 dc.l ptrdn

 dc.l waden
 dc.l ptren
 
 dc.l wadfn
 dc.l ptrfn
 
 dc.l -1,-1
 
wad1n:
 dc.b 'AB3D1:includes/ALIEN2.wad',0
 even
ptr1n:
 dc.b 'AB3D1:includes/ALIEN2.ptr',0
 even
wad2n:
 dc.b 'AB3D1:includes/PICKUPS.wad',0
 even
ptr2n:
 dc.b 'AB3D1:includes/PICKUPS.ptr',0
 even
wad3n:
 dc.b 'AB3D1:includes/uglymonster.wad',0
 even
ptr3n:
 dc.b 'AB3D1:includes/uglymonster.ptr',0
 even
wad4n:
 dc.b 'AB3D1:includes/flyingalien.wad',0
 even
ptr4n:
 dc.b 'AB3D1:includes/flyingalien.ptr',0
 even
wad5n:
 dc.b 'AB3D1:includes/keys.wad',0
 even
ptr5n:
 dc.b 'AB3D1:includes/keys.ptr',0
 even
wad6n:
 dc.b 'AB3D1:includes/rockets.wad',0
 even
ptr6n:
 dc.b 'AB3D1:includes/rockets.ptr',0
 even
wad7n:
 dc.b 'AB3D1:includes/barrel.wad',0
 even
ptr7n:
 dc.b 'AB3D1:includes/barrel.ptr',0
 even
wad8n:
 dc.b 'AB3D1:includes/bigbullet.wad',0
 even
ptr8n:
 dc.b 'AB3D1:includes/bigbullet.ptr',0
 even
wad9n:
 dc.b 'AB3D1:includes/newgunsinhand.wad',0
 even
ptr9n:
 dc.b 'AB3D1:includes/newgunsinhand.ptr',0
 even
wadan:
 dc.b 'AB3D1:includes/newmarine.wad',0
 even
ptran:
 dc.b 'AB3D1:includes/newmarine.ptr',0
 even
wadbn:
 dc.b 'AB3D1:includes/lamps.wad',0
 even
ptrbn:
 dc.b 'AB3D1:includes/lamps.ptr',0
 even
wadcn:
 dc.b 'AB3D1:includes/worm.wad',0
 even
ptrcn:
 dc.b 'AB3D1:includes/worm.ptr',0
 even
waddn:
 dc.b 'AB3D1:includes/explosion.wad',0
 even
ptrdn:
 dc.b 'AB3D1:includes/explosion.ptr',0
 even
waden:
 dc.b 'AB3D1:includes/bigclaws.wad',0
 even
ptren:
 dc.b 'AB3D1:includes/bigclaws.ptr',0
 even
wadfn:
 dc.b 'AB3D1:includes/tree.wad',0
ptrfn:
 dc.b 'AB3D1:includes/tree.ptr',0
 even
 
OBJ_ADDRS: ds.l 80
 
blocklen: dc.l 0
blockname: dc.l 0
blockstart: dc.l 0
 
BOTPICNAME: dc.b 'AB3D2:includes/panelraw',0
 even
PanelLen: dc.l 0
 
FREEBOTMEM:
 move.l Panel,d1
 move.l d1,a1
 move.l PanelLen,d0
 move.l 4.w,a6
 jsr -210(a6)

 rts
 
LOADBOTPIC:

 PRSDb

 move.l #BOTPICNAME,blockname

 move.l doslib,a6
 move.l blockname,d1
 move.l #1005,d2
 jsr -30(a6)
 move.l d0,handle
 
 lea fib,a5
 move.l handle,d1
 move.l a5,d2
 jsr -390(a6)
 
 move.l $7c(a5),blocklen
 move.l #30720,PanelLen
 
 move.l #2,d1
 move.l 4.w,a6
 move.l PanelLen,d0
 jsr -198(a6)
 move.l d0,blockstart
; move.l doslib,a6
; move.l blockname,d1
; move.l #1005,d2
; jsr -30(a6)
 move.l doslib,a6
; move.l d0,handle

 move.l handle,d1
 move.l LEVELDATA,d2
 move.l blocklen,d3
 jsr -42(a6)
 move.l doslib,a6
 move.l handle,d1
 jsr -36(a6)
 
 move.l blockstart,Panel
 
 move.l LEVELDATA,d0
 moveq #0,d1
 move.l Panel,a0
 lea WorkSpace,a1
 lea $0,a2
 jsr unLHA

 rts
 
LOADOBS:

 PRSDG

 move.l #OBJ_ADDRS,a2
 move.l #OBJ_NAMES,a0
 move.l #Objects,a1
 bsr LOAD_AN_OBJ
 move.l blockstart,(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,4(a1)

 bsr LOAD_AN_OBJ
 move.l blockstart,16(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,16+4(a1)

; bsr LOAD_AN_OBJ
; move.l blockstart,(16*3)(a1)
; bsr LOAD_AN_OBJ
; move.l blockstart,(16*3)+4(a1)

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*4)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*4)+4(a1)

 PRSDH

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*5)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*5)+4(a1)

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*6)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*6)+4(a1)

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*7)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*7)+4(a1)

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*2)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*2)+4(a1)

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*9)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*9)+4(a1)

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*10)(a1)
 move.l blockstart,(16*16)(a1)
 move.l blockstart,(16*17)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*10)+4(a1)
 move.l blockstart,(16*16)+4(a1)
 move.l blockstart,(16*17)+4(a1)

***********************

; load big monster here

***********************


 bsr LOAD_AN_OBJ
 move.l blockstart,(16*12)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*12)+4(a1) 

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*13)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*13)+4(a1) 

 PRSDI

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*8)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*8)+4(a1)

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*14)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*14)+4(a1) 

 bsr LOAD_AN_OBJ
 move.l blockstart,(16*15)(a1)
 bsr LOAD_AN_OBJ
 move.l blockstart,(16*15)+4(a1) 


**************************************
* Just for charles

; move.l doslib,a6
; move.l #TESTNAME,d1
; move.l #1005,d2
; jsr -30(a6)
; move.l d0,handle
;
; move.l handle,d1
; move.l #Spider_des,d2
; move.l #100000,d3
; jsr -42(a6)
; move.l doslib,a6
; move.l handle,d1
; jsr -36(a6)
************************************** 

 rts
 
;TESTNAME: dc.b 'ab3:includes/TESTOBJ'
; dc.b 0
; even
 
 CNOP 0,4
fib: ds.l 75

LOAD_AN_OBJ:
 movem.l a0/a1/a2,-(a7)
 
 move.l (a0),blockname
 
 move.l doslib,a6
 move.l blockname,d1
 move.l #1005,d2
 jsr -30(a6)
 move.l d0,handle
 
 lea fib,a5
 move.l handle,d1
 move.l a5,d2
 jsr -390(a6)
 
 move.l $7c(a5),blocklen
 
 move.l #1,d1
 move.l 4.w,a6
 move.l blocklen,d0
 jsr -198(a6)
 move.l d0,blockstart
; move.l doslib,a6
; move.l blockname,d1
; move.l #1005,d2
; jsr -30(a6)
 move.l doslib,a6
; move.l d0,handle

 move.l handle,d1
 move.l blockstart,d2
 move.l blocklen,d3
 jsr -42(a6)
 move.l doslib,a6
 move.l handle,d1
 jsr -36(a6)

 movem.l (a7)+,a0/a1/a2
 
 move.l blockstart,(a2)+
 move.l blocklen,(a2)+
 addq #4,a0

 rts
 
RELEASEOBJMEM:


 move.l #OBJ_NAMES,a0
 move.l #OBJ_ADDRS,a2

relobjlop
 move.l (a2)+,blockstart
 move.l (a2)+,blocklen
 addq #8,a0
 tst.l blockstart
 ble.s nomoreovj
 
 movem.l a0/a2,-(a7)
 
 move.l blockstart,d1
 move.l d1,a1
 move.l blocklen,d0
 move.l 4.w,a6
 jsr -210(a6)
 
 movem.l (a7)+,a0/a2
 bra.s relobjlop
 
nomoreovj:

 rts



 
LOAD_SFX:

 PRSDJ

 move.l #SFX_NAMES,a0
 move.l #SampleList,a1
LOADSAMPS
 move.l (a0)+,a2
 move.l a2,d0
 tst.l d0
 bgt.s oktoload
 blt.s doneload

 addq #4,a0
 addq #8,a1
 bra LOADSAMPS

doneload:
 
 move.l #-1,(a1)+
 rts
oktoload:
 move.l (a0)+,blocklen
 move.l a2,blockname
 movem.l a0/a1,-(a7)
 move.l #2,d1
 move.l 4.w,a6
 move.l blocklen,d0
 jsr -198(a6)
 move.l d0,blockstart
 move.l doslib,a6
 move.l blockname,d1
 move.l #1005,d2
 jsr -30(a6)
 move.l doslib,a6
 move.l d0,handle
 move.l d0,d1
 move.l blockstart,d2
 move.l blocklen,d3
 jsr -42(a6)
 move.l doslib,a6
 move.l handle,d1
 jsr -36(a6)
 movem.l (a7)+,a0/a1
 move.l blockstart,d0
 move.l d0,(a1)+
 add.l blocklen,d0
 move.l d0,(a1)+
 bra LOADSAMPS
 
 
 
LOADFLOOR
 PRSDK
 move.l #65536,d0
 move.l #1,d1
 move.l 4.w,a6
 jsr -198(a6)
 move.l d0,floortile

 move.l #floortilename,d1
 move.l #1005,d2
 move.l doslib,a6
 jsr -30(a6)
 move.l doslib,a6
 move.l d0,handle
 move.l d0,d1
 move.l floortile,d2
 move.l #65536,d3
 jsr -42(a6)
 move.l doslib,a6
 move.l handle,d1
 jsr -36(a6)
 
 rts

 
 
floortilename:
 dc.b 'AB3D1:includes/floortile'
 dc.b 0
 
 even

RELEASESAMPMEM:
 move.l #SampleList,a0
.relmem:
 move.l (a0)+,d1
 bge.s .okrel
 rts
.okrel:
 move.l (a0)+,d0
 sub.l d1,d0
 move.l d1,a1
 move.l 4.w,a6
 move.l a0,-(a7)
 jsr -210(a6)
 move.l (a7)+,a0
 bra .relmem

RELEASELEVELMEM:
 
 move.l LEVELGRAPHICS,d1
 move.l d1,a1
 move.l #50000,d0
 move.l 4.w,a6
 jsr -210(a6)
 
 move.l LEVELCLIPS,d1
 move.l d1,a1
 move.l #40000,d0
 move.l 4.w,a6
 jsr -210(a6)
 rts
 
RELEASEFLOORMEM:

 move.l floortile,d1
 move.l d1,a1
 move.l #65536,d0
 move.l 4.w,a6
 jsr -210(a6)
 rts
 
COPSCRN1: dc.l 0
COPSCRN2: dc.l 0
 
RELEASESCRNMEM:
 move.l COPSCRN1,d1
 move.l d1,a1
 move.l #(104*80*4)+16,d0
 move.l 4.w,a6
 jsr -210(a6)
 move.l COPSCRN2,d1
 move.l d1,a1
 move.l #(104*80*4)+16,d0
 move.l 4.w,a6
 jsr -210(a6)
; move.l COPSCRNBUFF,d1
; move.l d1,a1
; move.l #(104*80*4)+16,d0
; move.l 4.w,a6
; jsr -210(a6)

 rts 

unLHA:	incbin	"ab3:Decomp4.raw"
