animation preparations done

This commit is contained in:
~d6 2024-07-30 23:24:57 -04:00
parent 1cacc983c7
commit 4baecc3a4c
1 changed files with 38 additions and 13 deletions

View File

@ -243,7 +243,6 @@
INC GTHk ?&loop ( lim^ zp+1^ ) INC GTHk ?&loop ( lim^ zp+1^ )
&done POP POP2 JMP2r ( ) &done POP POP2 JMP2r ( )
( TODO: handle held cards in foundation by drawing one lower, or blank if ace held )
@draw-foundation ( -> ) @draw-foundation ( -> )
#0030 ,&y STR2 ( ; y0<-48 ) #0030 ,&y STR2 ( ; y0<-48 )
.foundation #04 OVR ADD SWP ( lim^ zp^ ) .foundation #04 OVR ADD SWP ( lim^ zp^ )
@ -258,7 +257,7 @@
@draw-tableau @draw-tableau
#0700 &loop DUP draw-column INC GTHk ?&loop POP2 JMP2r #0700 &loop DUP draw-column INC GTHk ?&loop POP2 JMP2r
@column-x ( idx^ -> x* ) @column-x ( col^ -> x* )
#00 SWP #0018 MUL2 #0030 ADD2 JMP2r #00 SWP #0018 MUL2 #0030 ADD2 JMP2r
@column-y ( col^ -> y* ) @column-y ( col^ -> y* )
@ -304,11 +303,30 @@
DUP #31 LTH #03 MUL ADD #24 SUB JMP2r DUP #31 LTH #03 MUL ADD #24 SUB JMP2r
&lt DUP #11 LTH #1d MUL ADD #09 ADD JMP2r &lt DUP #11 LTH #1d MUL ADD #09 ADD JMP2r
@stock-pos ( card^ -> x* y* )
#00 SWP #0008 SWP2 .stock SUB ( x=8* i* )
#03 SFT2 #fff8 SUB2 JMP2r ( x*, y=8-i/8* )
@waste-pos ( card^ -> x* y* )
#00 SWP .waste SUB #30 SFT2 ( 8i* )
#001c ADD2 #0008 JMP2r ( x=28+8i* y=8* )
@foundation-pos ( card^ -> x* y* )
#00 SWP #0008 SWP2 .foundation SUB ( x=8* i* )
#50 SFT2 #0020 ADD2 #0008 SWP2 JMP2r ( x*, y=48+32i* )
@tableau-pos ( card^ -> x* y* )
STHk #13 DIV STHk column-x ( x* [card^ col^] )
#00 STH2r #13 MUL SUB #30 SFT2 ( x* 8pos* )
#0024 ADD2 JMP2r ( x* y=36+8pos* )
@card-pos-xy ( card^ -> x* y* ) @card-pos-xy ( card^ -> x* y* )
( TODO ) #00 SWP .stock
( - copy from other implementations ) #33 ADD GTHk ?{ POP !stock-pos }
( - consider refactoring them to use this intead ) #18 ADD GTHk ?{ POP !waste-pos }
POP #ffff #ffff JMP2r ( FIXME ) #04 ADD GTHk ?{ POP !foundation-pos }
#85 ADD GTHk ?{ POP !tableau-pos }
POP2 #010e DEO #0000 #0000 JMP2r ( ; error, x=0, y=0 )
( we expect 0 <= time <= 16 ) ( we expect 0 <= time <= 16 )
@move-pos-xy ( -> x* y* ) @move-pos-xy ( -> x* y* )
@ -338,25 +356,32 @@
.move/src LDZ LDZ !draw-c ( ; draw card ) .move/src LDZ LDZ !draw-c ( ; draw card )
@end-move ( -> ) @end-move ( -> )
( TODO ) .move/src LDZ STH LDZ ( card^ [src^] )
( - copy the card over ) .move/dst LDZ STZ ( [src^] ; dst<-card )
( - do any necessary flipping, i.e. remove-card ) STHr remove-card ( ; remove card, flip, etc. )
( - zero out moving ) .move #0b initialize ( ; zero out move )
post-move draw ( ; finish move and draw )
!auto-move ( ; start another auto move maybe? )
@on-refresh ( -> brk ) @on-refresh ( -> brk )
.move/src LDZ #00 EQU ?{ update-move } .move/src LDZ #00 EQU ?{ update-move }
on-refresh-bear ( ; possibly refresh bear )
.frame LDZk INC SWP STZ ( ; increment frame counter )
BRK
@on-refresh-bear ( -> )
.frame LDZ .frame LDZ
DUP #e8 NEQ ?{ ;sprites #0040 ADD2 !&update } DUP #e8 NEQ ?{ ;sprites #0040 ADD2 !&update }
DUP #f0 NEQ ?{ ;sprites #0080 ADD2 !&update } DUP #f0 NEQ ?{ ;sprites #0080 ADD2 !&update }
DUP #f8 NEQ ?{ ;sprites #0040 ADD2 !&update } DUP #f8 NEQ ?{ ;sprites #0040 ADD2 !&update }
DUP #00 NEQ ?{ ;sprites !&update } DUP #00 NEQ ?{ ;sprites !&update }
!&done JMP2r
&update .Screen/addr DEO2 ( ; s/addr<-addr ) &update .Screen/addr DEO2 ( ; s/addr<-addr )
#0098 .Screen/y DEO2 ( ; s/x<-0x98 ) #0098 .Screen/y DEO2 ( ; s/x<-0x98 )
#00e8 .Screen/x DEO2 ( ; s/y<-0xe8 ) #00e8 .Screen/x DEO2 ( ; s/y<-0xe8 )
#16 .Screen/auto DEO ( ; draw 2 tiles, inc addr and y ) #16 .Screen/auto DEO ( ; draw 2 tiles, inc addr and y )
#80 .Screen/sprite DEO ( ; draw it! ) #80 .Screen/sprite DEO ( ; draw it! )
&done .frame LDZk INC SWP STZ BRK JMP2r
@on-mouse ( -> brk ) @on-mouse ( -> brk )
on-move on-move
@ -429,6 +454,7 @@
#01 AND ?&ok JMP2r &ok #01 AND ?&ok JMP2r &ok
maybe-select-stock ?&skip maybe-select-stock ?&skip
maybe-select-waste ?&found maybe-select-waste ?&found
( TODO: maybe-select-foundation )
maybe-select-tableau ?&found maybe-select-tableau ?&found
( not found ) .dragging #05 !initialize ( not found ) .dragging #05 !initialize
&found clear-prev-mouse !draw-curr-hold &found clear-prev-mouse !draw-curr-hold
@ -600,7 +626,6 @@
start-drag draw #01 JMP2r ( 1^ ) start-drag draw #01 JMP2r ( 1^ )
&no2 POP2r POPr &no1 #00 JMP2r ( 0^ ) &no2 POP2r POPr &no1 #00 JMP2r ( 0^ )
( TODO: handle empty column )
@maybe-select-tableau ( -> bool^ ) @maybe-select-tableau ( -> bool^ )
.Mouse/y DEI2 #0024 LTH2 ?&no1 ( ) .Mouse/y DEI2 #0024 LTH2 ?&no1 ( )
.Mouse/x DEI2 #0030 LTH2 ?&no1 ( ) .Mouse/x DEI2 #0030 LTH2 ?&no1 ( )