fix chat member speed scaling
This commit is contained in:
parent
07d3706473
commit
699603d466
19
main.fs
19
main.fs
|
@ -94,13 +94,15 @@ S" you feel like throwing some stuff into the pool." set-message
|
||||||
|
|
||||||
|
|
||||||
\ the word hire-chat-member hires a chat member.
|
\ the word hire-chat-member hires a chat member.
|
||||||
|
\ TODO something funky is going on with the rate past a certain point. find out where and why.
|
||||||
|
\ goes negative at 12 members, seems to be doing weird stuff before that with speeds.
|
||||||
: hire-chat-member
|
: hire-chat-member
|
||||||
membercost @ dup !0= swap \ checks if member cost is nonzero, leaving member cost on the stack
|
membercost @ dup !0= swap \ checks if member cost is nonzero, leaving member cost on the stack
|
||||||
devices @ <= \ tests if the member cost is less than the amount of devices we have
|
devices @ <= \ tests if the member cost is less than the amount of devices we have
|
||||||
and if
|
and if
|
||||||
devices @ membercost @ - devices ! \ remove devices that "pay" for the member
|
devices @ membercost @ - devices ! \ remove devices that "pay" for the member
|
||||||
membercount @ dup !0= if \ membercount is nonzero
|
membercount @ dup !0= if \ membercount is nonzero
|
||||||
devicerate @ swap 500 swap / - devicerate ! \ decrease the device delay by 500/membercount. TODO There is certainly a more elegent way to do this stack manipulation.
|
devicerate @ swap 1 + 500 swap / - devicerate !
|
||||||
else
|
else
|
||||||
devicerate @ 500 - devicerate ! drop
|
devicerate @ 500 - devicerate ! drop
|
||||||
then
|
then
|
||||||
|
@ -110,19 +112,26 @@ S" you feel like throwing some stuff into the pool." set-message
|
||||||
S" " set-message \ blank the message, because we did a thing.
|
S" " set-message \ blank the message, because we did a thing.
|
||||||
then ;
|
then ;
|
||||||
|
|
||||||
|
\ the word debug-console is used for entering debug mode.
|
||||||
|
\ TODO write debug mode. Ideally this could just be a forth console.
|
||||||
|
: debug-console
|
||||||
|
page
|
||||||
|
." Entering debug/cheat mode!"
|
||||||
|
page ;
|
||||||
|
|
||||||
\ the word handle-input handles input every time around the game loop.
|
\ the word handle-input handles input every time around the game loop.
|
||||||
: handle-input
|
: handle-input
|
||||||
key? if key case
|
key? if key case
|
||||||
[char] q of exit-game endof
|
[char] q of exit-game endof
|
||||||
[char] h of hire-chat-member endof
|
[char] h of hire-chat-member endof
|
||||||
|
[char] D of debug-console endof
|
||||||
endcase then ;
|
endcase then ;
|
||||||
|
|
||||||
\ print-rate prints the current device output rate on the screen.
|
\ print-rate prints the current device output rate on the screen.
|
||||||
: print-rate
|
: print-rate
|
||||||
2 set-precision
|
2 set-precision
|
||||||
\ first convert to floating point, divide by 1000 to get seconds from milliseconds, then do 1/n to get the devices/second from seconds/device
|
\ first convert to floating point, divide by 1000 to get seconds from milliseconds, then do 1/n to get the devices/second from seconds/device
|
||||||
." (" devicerate @ s>f 1000e f/ 1e fswap f/ f. ." devices/second)" ;
|
." (" devicerate @ s>f 1000e f/ 1e fswap f/ f. ." devices/second)";
|
||||||
|
|
||||||
\ draw-message draws the stored message on the screen.
|
\ draw-message draws the stored message on the screen.
|
||||||
: draw-message
|
: draw-message
|
||||||
|
@ -143,11 +152,7 @@ S" you feel like throwing some stuff into the pool." set-message
|
||||||
clear-line
|
clear-line
|
||||||
membercost @ dup !0= if \ if membercost is non-zero (members have been unlocked)
|
membercost @ dup !0= if \ if membercost is non-zero (members have been unlocked)
|
||||||
." (h)ire a chat member [" . ." Devices]"
|
." (h)ire a chat member [" . ." Devices]"
|
||||||
membercount @ dup 1 = if
|
space ." (" membercount @ 0 .R ." )"
|
||||||
space ." (you have 1 chat member helping you)" drop
|
|
||||||
else
|
|
||||||
space ." (you have " . ." chat members helping you)"
|
|
||||||
then
|
|
||||||
else drop then ;
|
else drop then ;
|
||||||
|
|
||||||
\ draw-actions draws a list of the actions you've unlocked.
|
\ draw-actions draws a list of the actions you've unlocked.
|
||||||
|
|
Reference in New Issue