CP - Alien Breed Remake - 5

Miscellaneous Forums/Blitz Showcase/CP - Alien Breed Remake - 5

To fix the VIS not working on blown up doors, replace the players.bb->damageTile function with this one:
Function DamageTile(x,y,val)
	;if the tile is not damageable then leave this function

	If x < 0 Then Return
	If y < 0 Then Return
	If x > 7552 Then Return
	If y > 7552 Then Return	

	x = Floor(x/32)
	y = Floor(y/32)

	If map(x,y,LayerHits) <0 Then Return

	map(x,y,LayerHits) = map(x,y,LayerHits) - val
	
	;if run out of hits
	If map(x,y,LayerHits) <1 Then 
		
		If map(x,y,LayerObject)>0 Then 
			If Instr(objectdef(map(x,y,LayerObject))\trigger,ScriptTrigger_OnDestroy) Then 
				;TODO: we probably need to keep track of which player owns which bullet, and pass that player in here
				RunScript(Player(1),objectdef(map(x,y,LayerObject)),ScriptTrigger_OnDestroy,x*32,y*32)				
			Else
				;default action for any other destructible object
				Map(x,y,LayerObject) = 0 
				Map(x,y,LayerCollision) = 0
			End If			
			CheckVis(x,y)
		EndIf		
	EndIf		
End Function

Also, why is the map getting drawn twice? I've removed the for i=1 to 2 at the top of the drawMap functions.