;; EXAMPLE 02c - List Objects (Player Animation)
;;
;; RAPTOR USER FILE
;;
;; Note: 	This file, and all other files, are tabulated for Notepad++
;;			Tabulation might be incorrect in other editors.
;;			use Notepad++ for maximum readability. 
;;


;; DO NOT MODIFY THE FOLLOWING LINES

			include				"../../JAGUAR.INC"										; Include JAGUAR system labels
			include				"../../RAPTOR/INCS/RAPTOR.INC"							; Include RAPTOR library labels

			.text							

;; YOUR APPLICATION GOES HERE
;; MODIFY AWAY!
						
;; VIDEO SETUP EQUATES
			
raptor_video_mode				equ				vidRGB16								; tell RAPTOR we want RGB 16 mode
raptor_video_enabled			equ				vidENABLE								; tell RAPTOR we want to Video ENABLED
raptor_video_VARMOD				equ				vidVARMOD_OFF							; tell RAPTOR we want VARMOD disabled
			
;; MAP MODULE SETUP EQUATES
			
raptor_first_map_object			equ				0										; Point RAPTOR to the first object of the map data
raptor_map_tiles_per_y			equ				0										; tell RAPTOR the height (in tiles) to display
raptor_map_tiles_per_x			equ				0										; tell RAPTOR the width (in tiles) to display
raptor_map_height				equ				0										; tell RAPTOR the map height (in tiles)
raptor_map_width				equ				0										; tell RAPTOR the map width (in tiles)
raptor_tilesize_x				equ				0										; tell RAPTOR the map tilesize (x) in pixels
raptor_tilesize_y				equ				0										; tell RAPTOR the map tilesize (y) in pixels
raptor_tilelinesz				equ				raptor_tilesize_x/2						; calculate the offset to next line of tile data
raptor_tilesize					equ				raptor_tilelinesz*raptor_tilesize_y		; calculate the byte size of a single tile

;; PARTICLE MODULE SETUP EQUATES

raptor_particle_buffer_width	equ				368										; tell RAPTOR the Particle / Text Buffer is 368 pixels wide
raptor_particle_buffer_height	equ				240										; tell RAPTOR the Particle / Text Buffer is 240 pixels high
raptor_particle_pixels			equ				50										; tell RAPTOR the maximum number of particles
raptor_particle_drift_x			equ				0										; tell RAPTOR the Particle Drift Factor (x)
raptor_particle_drift_y			equ				0										; tell RAPTOR the Particle Drift Factor (y)

;; some human friendly names

LIST_display					equ				0										; the first display list

ID_backdrop						equ				0										; RAPTOR Object number for the backdrop
ID_player						equ				1										; RAPTOR Object number for player
ID_textlayer					equ				2										; RAPTOR Object number for text layer

CLUT_player						equ				0										; 16 colour sub index into the 256 colour CLUT for the player sprite
CLUT_text						equ				15										; Text / Particle layer ALWAYS uses CLUT15

;;
;; The following lines **MUST** be at the start of EVERY RAPTOR APPLICATION
;; They configure the .OBJ file for use
;;	
			move.l	#raptor_video_mode,raptor_vidmode
			move.l	#raptor_video_enabled,raptor_videnable
			move.l	#raptor_video_VARMOD,raptor_varmod
			move.l	#raptor_first_map_object,raptor_maptop_obj
			move.l	#raptor_tilesize_x,raptor_tiles_x
			move.l	#raptor_tilesize_y,raptor_tiles_y
			move.l	#raptor_map_tiles_per_x+2,raptor_tilesperx
			move.l	#raptor_map_tiles_per_y+1,raptor_tilespery
			move.l	#raptor_map_width,raptor_mapwidth
			move.l	#raptor_map_height,raptor_mapheight
			move.l	#raptor_particle_pixels,raptor_maxparts
			move.l	#raptor_tilesize_x-1,raptor_tilerem_mask
			move.l	#raptor_particle_buffer_width,raptor_partbuf_x
			move.l	#raptor_particle_buffer_height,raptor_partbuf_y
			move.l	#raptor_particle_drift_x,raptor_pdriftx
			move.l	#raptor_particle_drift_y,raptor_pdrifty
			move.l	#top_of_bss,raptor_top_of_bss
			move.l	#_trashram,raptor_trashram
			move.l	#RAPTOR_MTtrash,raptor_MTwork
			move.l	#RAPTOR_user_vbi,raptor_uvbi_jmp
			move.l	#RAPTOR_POST_Object_List,raptor_poobjl
			move.l	#RAPTOR_PRE_Object_List,raptor_probjl
			move.l	#RAPTOR_font8x8,raptor_8x8_addr
			move.l	#RAPTOR_font8x16,raptor_8x16_addr
			move.l	#RAPTOR_font16x16,raptor_16x16_addr
			move.l	#RAPTOR_particle_palette,raptor_partipal
			move.l	#RAPTOR_particle_gfx,raptor_pgfx
			move.l	#RAPTOR_particle_gfxe,raptor_pgfxe
			move.l	#RAPTOR_sprite_table,raptor_spritetab
			move.l	#RAPTOR_particle_table,raptor_partitab
			move.l	#RAPTOR_MT_app_name,raptor_mtapp
			move.l	#RAPTOR_MT_file_name,raptor_mtfn
			move.l	#raptor_init_table,raptor_inittab
			move.l	#0,raptor_mapbmptiles					; <<<<---- THIS WILL NEED TO BE CHANGED IF USING THE TILEMAP MODULE <<<<----
			jsr		RAPTOR_HWinit														; Setup Jaguar hardware / install RAPTOR library

;; convert some graphics

			lea		BMP_BACKDROP,a0														; point to our TGA file
			lea		_trashram,a1														; some workram
			jsr		RAPTOR_GFXConvert													; Convert to Jaguar Bitmap 

			lea		BMP_PLAYER,a0														; point to our Windows BMP for the player
			lea		_trashram,a1														; some workram
			jsr		RAPTOR_GFXConvert													; Convert to Jaguar Bitmap
			lea		$f00400+(32*CLUT_player),a1											; which CLUT palette needs to move into
			jsr		RAPTOR_move_palette													; Copy the palette for the last converted bitmap to CLUT
			
;; get something on the screen
	
			jsr		RAPTOR_start_video													; start video processing
			move.l	#LIST_display,d0													; set RAPTOR to display initial RAPTOR list
			jsr		RAPTOR_setlist														; tell RAPTOR which list to process
			jsr		RAPTOR_UPDATE_ALL													; and update the object list with initial values
			
;; put some text on the screen
			
			lea		txt_hello_world,a0													; point to a text string
			move.l	#20,d0																; x=20
			move.l	#20,d1																; y=20
			moveq	#0,d2																; Font Size = 0 (8x8)
			moveq	#0,d3																; Font Index = 0
			jsr		RAPTOR_print														; PRINT the version
				
LOOP:		jsr		RAPTOR_wait_frame_UPDATE_ALL										; Sync to VBLANK and Update ALL RAPTOR objects
			bra		LOOP
																						; Loop around!
;;
;; Some text to demo the RAPTOR_print command
;;
	
txt_hello_world:	
			dc.b	raptor_t_font_siz,0													; set font size to 0 (8x8)
			dc.b	"SCORE:"
			dc.b	raptor_t_quit														; end of string
			.even		
						
;;
;; RAPTOR user VBI vector
;;

RAPTOR_user_vbi:	
			rts																			; we're not using this, nothing tied to the vblank

;;
;; Creating Non-RAPTOR objects around the list
;;		

RAPTOR_PRE_Object_List:																	; No unmanaged objects before the list
			rts

RAPTOR_POST_Object_List:																; No unmanaged Objects after the list									
			rts
						
							include		"_RAPPIXL.S"									; RAPTOR particle module user data
							include 	"_RAPINIT.S"									; RAPTOR object user data
	
;;
;; Graphics
;;
							.dphrase
							dc.l	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
				
RAPTOR_font8x8:				incbin	"../../RAPTOR/FONTS/F_8x8.BMP"						; User defined 8x8 fonts
							.dphrase
RAPTOR_font8x16:			incbin	"../../RAPTOR/FONTS/F_8x16.BMP"						; User defined 8x16 fonts
							.dphrase
RAPTOR_font16x16:			incbin	"../../RAPTOR/FONTS/F_16x16.BMP"					; User defined 16x16 fonts
							.dphrase
RAPTOR_particle_palette:	incbin	"../../RAPTOR/FONTS/PARTIPAL.BMP"					; User defined palette for fonts and particles
							
							.dphrase
BMP_BACKDROP:				incbin	"../DATAFILE/GFX/BACKDROP.TGA"						; screen backdrop bitmap
							.dphrase
BMP_PLAYER:					incbin	"../DATAFILE/GFX/PLAYER.BMP"						; animated object for player
;;
;; BSS SECTION
;;

							.bss
top_of_bss:

RAPTOR_MTtrash:				.ds.b	16384																		; Workspace for MemoryTrack routines

							.dphrase
RAPTOR_particle_gfx:		.ds.b	(raptor_particle_buffer_width/2)*raptor_particle_buffer_height				; particle FX buffer
RAPTOR_particle_gfxe:			
							.dphrase
RAPTOR_sprite_table:		.ds.b	sprite_max*sprite_tabwidth													; RAPTOR sprite database
							.dphrase
RAPTOR_particle_table:		.ds.b	raptor_particle_pixels*particle_tabwidth									; RAPTOR particle database
							.dphrase
							
_trashram:
								
;END OF FILE

				
