~rabbits/donsol

9274abf82a0ff6391a199b3e9ba16aa29217d144 — neauoire 1 year, 4 months ago 3e708be
Card flipping
1 files changed, 34 insertions(+), 13 deletions(-)

M src/main.tal
M src/main.tal => src/main.tal +34 -13
@@ 52,8 52,7 @@
	&hp $1 &sp $1 &sp-max $1 &xp $1 
	&run $1 &sick $1
@table
	&a $1 &b $1 &c $1 &d $1
@selection $1
	&a $1 &b $1 &c $1 &d $1 &selection $1
@cursor
	&x $2 &y $2 &last $1
@frame


@@ 101,9 100,9 @@ BRK
	
	.Controller/button DEI #04 SFT
	[ #04 ] !~ ,&no-left JCN
		.selection LDZ #01 - #00 ;select JSR2 POP BRK &no-left
		.table/selection LDZ #01 - #00 ;select JSR2 POP BRK &no-left
	[ #08 ] !~ ,&no-right JCN
		.selection LDZ INC #00 ;select JSR2 POP BRK &no-right
		.table/selection LDZ INC #00 ;select JSR2 POP BRK &no-right
	POP

BRK


@@ 114,11 113,12 @@ BRK
	.Mouse/y DEI2 .frame/y LDZ2 #0030 ++ -- #0048 <<
	.Mouse/x DEI2 .frame/x LDZ2 -- #00e0 <<
		#0101 !! ,&no-hover JCN
			.Mouse/x DEI2 .frame/x LDZ2 -- #0038 // TOB #00 ;select JSR2
			.Mouse/x DEI2 .frame/x LDZ2 -- #0038 // TOB 
			.Mouse/state DEI #00 !
				;select JSR2
			( release ) #00 .Mouse/state DEO
			&no-hover

	;draw-cursor JSR2

	( release-record ) #0000 .Mouse/state DEO .cursor/last STZ

BRK


@@ 181,23 181,44 @@ RTN

RTN

@use-card ( id -- )

	DUP #36 < ,&not-flipped JCN
		POP RTN
		&not-flipped
	DEBUG

RTN

@return-card ( -- )

RTN

@flip-card ( table -- )

	#36 SWP .table + STZ
	;draw-table JSR2

RTN

@select ( id state -- )

	SWP 
	( skip changed if has state )
	OVR ,&state JCN
	( check changed )
	DUP .selection LDZ ! ,&changed JCN
	DUP .table/selection LDZ ! ,&changed JCN
		POP2 RTN
		&changed
	&state
	( erase old selection ) #00 ;draw-selection JSR2
	( TODO: run ) 
	4MOD .selection STZ
	#03 ;draw-selection JSR2

	POP
	OVR #00 = ,&no-use JCN
		DUP .table + LDZ ;use-card JSR2
		DUP ;flip-card JSR2
		&no-use
	4MOD .table/selection STZ
	#03 ;draw-selection JSR2

RTN



@@ 287,7 308,7 @@ RTN
		#02
		;draw-label JSR2

	.frame/x LDZ2 #0014 ++ [ .selection LDZ TOS #0038 ** ++ ] .Screen/x DEO2
	.frame/x LDZ2 #0014 ++ [ .table/selection LDZ TOS #0038 ** ++ ] .Screen/x DEO2
	.frame/y LDZ2 #007c ++ .Screen/y DEO2
	;cursor-up-icn .Screen/addr DEO2
		STHr .Screen/sprite DEO