~rabbits/markl

1c55752b6581514171d55a5a6c4c68d38e7b50aa — Devine Lu Linvega a month ago 12ed848
Events have drawing handlers
2 files changed, 18 insertions(+), 17 deletions(-)

M src/events.tal
M src/markl.tal
M src/events.tal => src/events.tal +15 -10
@@ 1,39 1,44 @@
( Events Collection )

@event-goat =&on-draw =&on-collision =npc-spell-chr
@event-goat =&on-draw =&on-collision
	&on-draw ( self* -- )
	POP2 JMP2r
	POP2 .Screen/y DEI2 #0028 SUB2 .Screen/y DEO2
	;blocker-chr !<draw-tall>

	&on-collision ( self* -- fail )
	( spell* ) #0004 ADD2 LDA2 <animate-unlock-spell>
	#01 JMP2r

@event-block =&on-draw =&on-collision =blocker-chr
@event-block =&on-draw =&on-collision
	&on-draw ( self* -- )
	POP2 JMP2r
	POP2 .Screen/y DEI2 #0028 SUB2 .Screen/y DEO2
	;blocker-chr !<draw-tall>

	&on-collision ( self* -- fail )
	POP2 #01 JMP2r

@event-nimp =&on-draw =&on-collision =npc-size-chr
@event-nimp =&on-draw =&on-collision
	&on-draw ( self* -- )
	POP2 JMP2r
	POP2 .Screen/y DEI2 #0028 SUB2 .Screen/y DEO2
	;npc-size-chr !<draw-tall>

	&on-collision ( self* -- fail )
	( slot* ) #0004 ADD2 LDA2 <animate-unlock-size>
	#01 JMP2r

@event-warp =&on-draw =&on-collision =warp-chr
@event-warp =&on-draw =&on-collision
	&on-draw ( self* -- )
	POP2 JMP2r
	POP2 .Screen/y DEI2 #0028 SUB2 .Screen/y DEO2
	;warp-chr !<draw-tall>

	&on-collision ( self* -- fail )
	<animate-warp>
	#00 JMP2r

@event-door =&on-draw =&on-collision =door-chr
@event-door =&on-draw =&on-collision
	&on-draw ( self* -- )
	POP2 JMP2r
	POP2 .Screen/y DEI2 #0038 SUB2 .Screen/y DEO2
	;door-chr !<draw-tall>

	&on-collision ( self* -- fail )
	<animate-door>

M src/markl.tal => src/markl.tal +3 -7
@@ 668,12 668,6 @@
	#00c0 .Screen/y DEO2
	;button-a-icn !<draw-round-button>

@<draw-event> ( addr* -- )
	.Screen/y DEI2 #0028 SUB2 .Screen/y DEO2
	#0004 ADD2 LDA2 <draw-tall>
	.Screen/y DEI2 #0018 SUB2 .Screen/y DEO2
	JMP2r

@<pin-floor> ( x y -- )
	#00 SWP #001b MUL2 .camera/y LDZ2 ADD2 .Screen/y DEO2
	#00 SWP #001e MUL2 .camera/x LDZ2 ADD2 .Screen/x DEO2


@@ 699,7 693,9 @@
			DUP OVR2 POP DUP2 <pin-floor>
			( | event )
			DUP2 get-event DUP2 #ffff EQU2 ?{
				DUP2 #0002 ADD2 LDA2 <draw-event> }
				( self* ) DUP2
				( event* ) INC2k INC2 LDA2
				( on-draw* ) LDA2 JSR2 }
			POP2 POP2 INC GTHk ?&>lwe
		POP2
		( | draw player )