From fd185c4fb0b5e61a7eac001040686d103e37f915 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Sat, 10 Jun 2023 19:47:46 -0700 Subject: [PATCH] (lander)Apply less than max force --- gui/lander/lander.tal | 53 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/gui/lander/lander.tal b/gui/lander/lander.tal index 2601190..bb6b3c7 100644 --- a/gui/lander/lander.tal +++ b/gui/lander/lander.tal @@ -7,6 +7,12 @@ |80 @Controller &vector $2 &button $1 &key $1 |90 @Mouse &vector $2 &x $2 &y $2 &state $1 &wheel $1 +|0000 + + @pos &x $2 &y $2 + @force &x $2 &y $2 + @angle $2 + |0100 ( -> ) ( theme ) @@ -31,16 +37,22 @@ BRK [ LIT &f $1 ] INCk ,&f STR #01 AND ?&no-read .Controller/button DEI - DUP #80 NEQ ?&no-u - ;get-pt/offset LDA #01 SUB ;get-pt/offset STA - ;draw-lander/plume LDA INC ;draw-lander/plume STA + DUP #10 NEQ ?&no-u + .force/y LDZ2 #0008 SUB2 .force/y STZ2 &no-u - DUP #40 NEQ ?&no-d - ;get-pt/offset LDA INC ;get-pt/offset STA + DUP #40 NEQ ?&no-l + .angle LDZ2 #0001 SUB2 .angle STZ2 ;draw-lander/plume LDA INC ;draw-lander/plume STA - &no-d + &no-l + DUP #80 NEQ ?&no-r + .angle LDZ2 INC2 .angle STZ2 + ;draw-lander/plume LDA INC ;draw-lander/plume STA + &no-r POP + &no-read + apply-force + ( .force/y LDZ2 phex #0a18 DEO ) redraw BRK @@ -49,6 +61,23 @@ BRK BRK +( +@|core ) + +@apply-force ( -- ) + + .force/y LDZ2 INC2 .force/y STZ2 + .force/y LDZ2 reduce .pos/y LDZ2 ADD2 .pos/y STZ2 + +JMP2r + +@reduce ( force* -- ) + + DUP2 #8000 AND2 ORA ?&neg + #02 SFT2 +JMP2r +&neg abs2 #02 SFT2 #0000 SWP2 SUB2 JMP2r + ( @|drawing ) @@ -82,8 +111,8 @@ JMP2r ( face ) #26 .Screen/auto DEO ;face-icn .Screen/addr DEO2 - #0014 .Screen/x DEO2 - #0014 .Screen/y DEO2 + #0014 .pos/x LDZ2 ADD2 .Screen/x DEO2 + #0014 .pos/y LDZ2 ADD2 .Screen/y DEO2 #05 .Screen/sprite DEOk DEOk DEO #00 .Screen/auto DEO @@ -105,9 +134,9 @@ JMP2r @get-pt ( id rad -- x* y* ) - #00 SWP STH2 + #00 SWP STH2 - [ LIT &offset $1 ] ADD + .angle LDZ2 NIP ADD !get-point/force @@ -119,9 +148,11 @@ JMP2r #00 SWP ;circle-tbl ADD2 LDA2 #00 SWP STH2kr MUL2 #04 SFT2 ( center ) #0080 STH2kr #30 SFT2 SUB2 ADD2 #02 SFT2 + ( pos ) .pos/y LDZ2 ADD2 ROT #00 SWP STH2kr MUL2 #04 SFT2 ( center ) #0080 STH2kr #30 SFT2 SUB2 ADD2 #02 SFT2 + ( pos ) .pos/x LDZ2 ADD2 SWP2 POP2r @@ -178,7 +209,7 @@ JMP2r 0804 0201 0000 0000 c33c 0081 7e00 0000 1020 4080 0000 0000 - ] +] @circle-tbl [ 8000 9802 b009 c715 da25 ea38 f64f fd67