;*********************
;**** COMMON STUFF ***
;*********************
;
;used as extra stuff for levels

;*****************************
;*** TRANSFERS A STAR CHAR ***
;*****************************
;
;deinterlace char for star specific render code
; HL = point to sprite structure (typycally after USPGADD or TSPGADD ) - IY = dest
.FX_TranferStar
	
	;get first tile
	inc HL	;global flag
	inc HL	;tile flags
	ld A,(HL)	;low addr
	inc HL	
	ld H,(HL)	;high addr
	ld L,A
	
	;we got tile so copy it
	;use IX and IY to keep it simple
	push HL
	pop IX
;line 0 = 0
	ld A,(IX+0)
	ld (IY+0),A
	ld A,(IX+1)
	ld (IY+1),A
;line 1 = 1 R 
	ld A,(IX+2)
	ld (IY+3),A
	ld A,(IX+3)
	ld (IY+2),A	
;line 2 = 3 R
	ld A,(IX+6)
	ld (IY+5),A
	ld A,(IX+7)
	ld (IY+4),A
;line 3 = 2
	ld A,(IX+4)
	ld (IY+6),A
	ld A,(IX+5)
	ld (IY+7),A
;line 4 = 7 R 
	ld A,(IX+14)
	ld (IY+9),A
	ld A,(IX+15)
	ld (IY+8),A
;line 5 = 6
	ld A,(IX+12)
	ld (IY+10),A
	ld A,(IX+13)
	ld (IY+11),A
;line 6 = 4
	ld A,(IX+8)
	ld (IY+12),A
	ld A,(IX+9)
	ld (IY+13),A
;line 7 = 5 R
	ld A,(IX+10)
	ld (IY+15),A
	ld A,(IX+11)
	ld (IY+14),A
	
	ret


;
;*********************
;*** DRAW A SPRITE ***
;*********************
;A = direction - A' = sprite	
.FX_DrawSprite
	ex AF,AF'
	CALL TSPGADD
	ex AF,AF'
	
	and 3
	jr nz,FX_NotSPNS
	CALL SPNS
	jr FX_DrawDone
	
.FX_NotSPNS
	cp 1
	jr nz,FX_NotSPMS
	call SPMS
	jr FX_DrawDone
	
.FX_NotSPMS
	cp 2
	jr nz,FX_NotSPFS
	call SPFS
	jr FX_DrawDone
	
.FX_NotSPFS
	call SPBS
	
.FX_DrawDone
	ret