~rabbits/donsol

d2e177bfc92ad960f0ca8c76c7de1cf455d48414 — neauoire 1 year, 2 months ago d665fe9
Added theme support
3 files changed, 58 insertions(+), 7 deletions(-)

M .gitignore
D .theme
M src/main.tal
M .gitignore => .gitignore +2 -1
@@ 4,4 4,5 @@ tools/asm6
tools/lin6
cart.nes

.snarf
\ No newline at end of file
.snarf
.theme
\ No newline at end of file

D .theme => .theme +0 -1
@@ 1,1 0,0 @@
���Y�Y
\ No newline at end of file

M src/main.tal => src/main.tal +56 -5
@@ 34,7 34,7 @@
|20 @Screen     &vector $2 &width   $2 &height $2 &auto  $1 &pad   $1 &x     $2 &y $2 &addr $2 &pixel $1 &sprite $1
|80 @Controller &vector $2 &button  $1 &key    $1
|90 @Mouse      &vector $2 &x       $2 &y      $2 &state $1 &chord $1
|a0 @File       &vector $2 &success $2 &offset $2 &pad   $2 &name  $2 &length $2 &load $2 &save $2
|a0 @File       &vector $2 &success  $2 &stat   $2 &delete $1 &append $1 &name   $2 &length $2 &read   $2 &write $2
|b0 @DateTime   &year   $2 &month   $1 &day    $1 &hour  $1 &minute $1 &second $1 &dotw $1 &doty   $2 &isdst $1

( variables )


@@ 79,6 79,12 @@
	DUP2 HEIGHT 2// -- .frame/y STZ2
		HEIGHT 2// ++ .frame/y2 STZ2

	( random )
	;prng-init JSR2

	( theme support )
	;load-theme JSR2

	#09 .player/hp STZ
	#0a .player/sp STZ
	#0b .player/xp STZ


@@ 267,6 273,7 @@ BRK
		;run JSR2 POP BRK
		&no-b
	[ #08 ] !~ ,&no-sel JCN
		;load-theme JSR2
		;go-menu JSR2 POP BRK
		&no-sel
	#04 SFT


@@ 276,6 283,7 @@ BRK
	[ #08 ] !~ ,&no-right JCN
		.table/selection LDZ INC #00 ;select JSR2 POP BRK
		&no-right

	POP

BRK


@@ 383,8 391,8 @@ RTN
	( first shuffle )
	#3600
	&a
		DUPk
			( seed ) .DateTime/month DEI2 + * .DateTime/day DEI2 + + #36 MOD
		DUP
			( seed ) [ ;prng JSR2 + ] #36 MOD
			( a b ) OVR .deck/cards + LDZ OVR .deck/cards + LDZ
			( b a ) SWP2 STH .deck/cards + STZ STHr .deck/cards + STZ
		INC GTHk ,&a JCN


@@ 392,8 400,8 @@ RTN
	( second shuffle )
	#3600
	&b
		DUPk
			( seed ) .DateTime/hour DEI2 + * .DateTime/minute DEI2 + + #36 MOD
		DUP
			( seed ) [ ;prng JSR2 + ] #36 MOD
			( a b ) OVR .deck/cards + LDZ OVR .deck/cards + LDZ
			( b a ) SWP2 STH .deck/cards + STZ STHr .deck/cards + STZ
		INC GTHk ,&b JCN


@@ 909,5 917,48 @@ RTN

RTN

( random )

@prng-init ( -- )

	( seed )
	#00 .DateTime/second DEI
	#00 .DateTime/minute DEI #60 SFT2 EOR2
	#00 .DateTime/hour   DEI #c0 SFT2 EOR2 ,prng/x STR2
	#00 .DateTime/hour   DEI #04 SFT2
	#00 .DateTime/day    DEI #10 SFT2 EOR2
	#00 .DateTime/month  DEI #60 SFT2 EOR2
		.DateTime/year  DEI2 #a0 SFT2 EOR2 ,prng/y STR2

JMP2r

@prng ( -- number* )

	LIT2 &x $2
	DUP2 #50 SFT2 EOR2
	DUP2 #03 SFT2 EOR2
	LIT2 &y $2 DUP2 ,&x STR2
	DUP2 #01 SFT2 EOR2 EOR2
	,&y STR2k POP

JMP2r

@theme-txt ".theme $1

@load-theme ( -- )

	;theme-txt .File/name DEO2
	#0006 .File/length DEO2
	#fffa .File/read DEO2

	.File/success DEI2 #0006 !! ,&ignore JCN
		#fffa LDA2 .System/r DEO2
		#fffc LDA2 .System/g DEO2
		#fffe LDA2 .System/b DEO2
		&ignore
	;redraw JSR2

RTN

~src/strings.tal
~src/assets.tal