From 1c55752b6581514171d55a5a6c4c68d38e7b50aa Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 31 Jul 2024 17:26:59 -0700 Subject: [PATCH] Events have drawing handlers --- src/events.tal | 25 +++++++++++++++---------- src/markl.tal | 10 +++------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/events.tal b/src/events.tal index 780fde3..41eaf53 100644 --- a/src/events.tal +++ b/src/events.tal @@ -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 ! &on-collision ( self* -- fail ) ( spell* ) #0004 ADD2 LDA2 #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 ! &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 ! &on-collision ( self* -- fail ) ( slot* ) #0004 ADD2 LDA2 #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 ! &on-collision ( self* -- fail ) #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 ! &on-collision ( self* -- fail ) diff --git a/src/markl.tal b/src/markl.tal index 96d5ada..b85bc0a 100644 --- a/src/markl.tal +++ b/src/markl.tal @@ -668,12 +668,6 @@ #00c0 .Screen/y DEO2 ;button-a-icn ! -@ ( addr* -- ) - .Screen/y DEI2 #0028 SUB2 .Screen/y DEO2 - #0004 ADD2 LDA2 - .Screen/y DEI2 #0018 SUB2 .Screen/y DEO2 - JMP2r - @ ( 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 ( | event ) DUP2 get-event DUP2 #ffff EQU2 ?{ - DUP2 #0002 ADD2 LDA2 } + ( self* ) DUP2 + ( event* ) INC2k INC2 LDA2 + ( on-draw* ) LDA2 JSR2 } POP2 POP2 INC GTHk ?&>lwe POP2 ( | draw player ) -- 2.45.2