All pastes #751929 Raw Edit

Stuff

public text v1 · immutable
#751929 ·published 2007-10-27 21:20 UTC
rendered paste body
ObjS1Ring:	
	moveq	#0,d0
	move.b	$24(a0),d0
	move.w	ObjS1Ring_Index(pc,d0.w),d1
	jmp	ObjS1Ring_Index(pc,d1.w)
; ===========================================================================
ObjS1Ring_Index:	
	dc.w ObjS1Ring_Main-ObjS1Ring_Index
	dc.w ObjS1Ring_Animate-ObjS1Ring_Index
	dc.w ObjS1Ring_Collect-ObjS1Ring_Index
	dc.w ObjS1Ring_Sparkle-ObjS1Ring_Index
	dc.w ObjS1Ring_Delete-ObjS1Ring_Index
; ---------------------------------------------------------------------------
; Distances between Rings (format: horizontal,vertical)
; ---------------------------------------------------------------------------
ObjS1Ring_PosData:	dc.b $10,0	; horizontal tight
	dc.b $18,0	; horizontal normal
	dc.b $20,0	; horizontal wide
	dc.b 0,$10	; vertical tight
	dc.b 0,$18	; vertical normal
	dc.b 0,$20	; vertical wide
	dc.b $10,$10	; diagonal
	dc.b $18,$18
	dc.b $20,$20
	dc.b $F0,$10
	dc.b $E8,$18
	dc.b $E0,$20
	dc.b $10,8
	dc.b $18,$10
	dc.b $F0,8
	dc.b $E8,$10
; ===========================================================================
ObjS1Ring_Main:
;	clr.b	$2F(a0)	;clear attracted flag
	lea	($FFFFFC00).w,a2
	moveq	#0,d0
	move.b	$23(a0),d0
	lea	2(a2,d0.w),a2
	move.b	(a2),d4
	move.b	$28(a0),d1
	move.b	d1,d0
	andi.w	#7,d1
	cmp.w	#7,d1
	bne.s	loc1_9B80
	moveq	#6,d1
loc1_9B80:
	swap	d1
	move.w	#0,d1
	lsr.b	#4,d0
	add.w	d0,d0
	move.b	ObjS1Ring_PosData(pc,d0.w),d5 ; Load Ring spacing data
	ext.w	d5
	move.b	ObjS1Ring_PosData+1(pc,d0.w),d6
	ext.w	d6
	movea.l	a0,a1
	move.w	8(a0),d2
	move.w	$C(a0),d3
	lsr.b	#1,d4
	bcs.s	loc1_9C02
	bclr	#7,(a2)
	bra.s loc1_9BBA
		
; ===========================================================================
ObjS1Ring_MakeRings:
	swap	d1
	lsr.b	#1,d4
	bcs.s	loc1_9C02
	bclr	#7,(a2)
	bsr.w	SingleObjLoad
	bne.s	loc1_9C0E
loc1_9BBA:	
	move.b	#$25,0(a1)	; Load Ring Object
	addq.b	#2,$24(a1)
	move.w	d2,8(a1)	; set x-axis position based on d2
	move.w	8(a0),$32(a1)
	move.w	d3,$C(a1)	; set y-axis position based on d3
	move.l	#Obj25_MapUnc_12382,4(a1)
	move.w	#$26BC,2(a1)
	move.b	#4,1(a1)
	move.b	#2,$18(a1)
	move.b	#$47,$20(a1)
	move.b	#8,$19(a1)
	move.b	$23(a0),$23(a1)
	move.b	d1,$34(a1)
loc1_9C02:
	addq.w	#1,d1
	add.w	d5,d2	; add Ring spacing value To d2
	add.w	d6,d3	; add Ring spacing value To d3
	swap	d1
	dbf	d1,ObjS1Ring_MakeRings ; repeat for	number of Rings
loc1_9C0E:
	btst	#0,(a2)
	bne.w	DELETEObject	
ObjS1Ring_Animate:	
;	jsr	Move_Rings_For_LightningShield
;	move.b	($FFFFFEC3).w,$1A(a0) ;	set Frame
	move.b	(Rings_anim_frame).w,mapping_frame(a0)

	bsr.w	DisplaySprite
	move.w	$32(a0),d0
	andi.w	#$FF80,d0
	move.w	($FFFFEE00).w,d1
	sub.w	#$80,d1
	andi.w	#$FF80,d1
	sub.w	d1,d0
	cmp.w	#$280,d0
	bhi.s	ObjS1Ring_shDelete
	rts	
; ===========================================================================
ObjS1Ring_Collect:	
	addq.b	#2,$24(a0)
	move.b	#0,$20(a0)
	move.b	#1,$18(a0)
	bsr.s	COLLECTRings1
		
	lea	($FFFFFC00).w,a2
	moveq	#0,d0
	move.b	$23(a0),d0
	move.b	$34(a0),d1
	bset	d1,2(a2,d0.w)
ObjS1Ring_Sparkle:	
	;lea	(Ani_ObjS1Ring).l,a1
	lea	(byte_1237A).l,a1
	bsr.w	ANIMATESprite
	bra.w	DisplaySprite
; ===========================================================================
ObjS1Ring_shDelete:	
;	btst	#0,$2F(a0)		; Check if ring was attracted
;	beq.s	+			; If not, skip this workaround
;	cmp.b	#3,($FFFFFE2C).w	; Check for electric shield
;	bne.s	+			; If not, delete object straight up
;	btst	#1,$2F(a0)		; Check if the "ring is far away" flag is on
;	bne.s	+			; If yes, delete object, otherwise return
;	rts
ObjS1Ring_Delete:
+	jmp	(DeleteObject).l
; ;;;;;;;;;;;;;;; S U B	R O U T	I N E ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
CollectRings1:	
	addq.w	#1,($FFFFFE20).w ; add 1 To Rings
	cmp.w	#999,($FFFFFE20).w	; Compare to 999
	ble.s	+
	move.w	#999,($FFFFFE20).w
+
	ori.b	#1,($FFFFFE1D).w ; update the Rings counter
	move.w	#$B5,d0	; Play Ring Sound
ObjS1Ring_PlaySnd:
	jmp	(PlaySoundStereo).w
; End of function CollectRing