Open ChristopherDrum opened 2 years ago
I've verified that r116 (Masterpieces edition) does not have this issue. r160 and the source here do.
How is it supposed to work?
Is it the call xxx-xxxx
that should work?
That's correct. I believe that any number listed in the address book should give you some kind of response (though I've only tried a few), not a complaint that it "doesn't know the word" (phone number)
The problem seems to be in the DO-NUMBER?
routine. So far I can see, when you type, for example , call 123-456
, it should return:
123 in the global P-EXCHANGE
456 in the global P-NUMBER
and the routine should return W?INTNUM
DO-NUMBER?
with the following changes does just that, but I'm not completely sure that it don't break anything else. Should need some testing.
<DEFINE DO-NUMBER? NN (PTR:FIX "OPT" (CNT:FIX 0) "AUX"
BPTR:FIX CHR:FIX (SUM:FIX 0)
(TIM:<OR FIX FALSE> <>) (EXC <>) (DOLLAR <>) CCTR
(TMP <>) NW (SAVED-PTR .PTR) (MINUS? <>))
<COND (<0? .CNT>
<SET CNT <GETB <ZREST ,P-LEXV <* .PTR 2>> 2>>
<SET TMP T>)>
<SET BPTR <GETB <ZREST ,P-LEXV <* .PTR 2>> 3>>
<SET CHR <GETB ,P-INBUF <+ .BPTR .CNT -1>>>
<COND (<AND .TMP
<G=? .CNT 2>
<B-THRU-E? .CHR>
<OR <N==? <GETB ,P-INBUF <+ .BPTR .CNT -2>>
%<ASCII !\->>
<G=? .CNT 3>>>
; "Handle case of seat number (13b, whatever). Pseudo handler
for seat will do the right thing with this. First make sure
it ends with a letter, and is long enough"
<SET CNT <- .CNT 1>>
<COND (<==? <GETB ,P-INBUF <+ .BPTR .CNT -1>>
%<ASCII !\->>
; "kludge so 13-b works as well as 13b"
<SET CNT <- .CNT 1>>)>
<COND (<==? <SET TMP <DO-NUMBER? .PTR .CNT>>
,W?INTNUM>
; "Got a real number before the seat letter, so
win."
<COND (<G=? .CHR %<ASCII !\a>>
<SET CHR <- .CHR %<ASCII !\b>>>)
(T
<SET CHR <- .CHR %<ASCII !\B>>>)>
; "Get a code number for the seat..."
<SETG P-SEAT-NUMBER <+ <* <- ,P-NUMBER:FIX 1> 4> .CHR>>
<SETG P-NUMBER -1>
<RETURN ,W?INTNUM .NN>)
(T
; "Lost, so just give up"
<RETURN <> .NN>)>)>
<REPEAT ()
<COND (<L? <SET CNT <- .CNT 1>> 0>
<RETURN>)>
<SET CHR <GETB ,P-INBUF .BPTR>>
<COND (<==? .CHR %<ASCII !\#>> T)
(<EQUAL? .CHR %<ASCII !\:>>
<COND (<T? .EXC>
<RETURN <> .NN>)>
<SET TIM .SUM>
<SET SUM 0>)
(<EQUAL? .CHR %<ASCII !\->>
<COND (<T? .TIM>
<RETURN <> .NN>)>
<SET MINUS? T>
<SET EXC .SUM>
<SET SUM 0>)
(<G? .SUM 9999>
<RETURN <> .NN>)
(<EQUAL? .CHR %<ASCII !\$>>
<SET DOLLAR T>)
(<AND <G? .CHR %<- <ASCII !\0> 1>>
<L? .CHR %<+ <ASCII !\9> 1>>>
<SET SUM <+ <* .SUM 10> <- .CHR %<ASCII !\0>>>>)
(T
<RETURN <> .NN>)>
<SET BPTR <+ .BPTR 1>>>
<CHANGE-LEXV .PTR ,W?INTNUM>
<COND (<G? ,P-LEN:FIX 1>
<SET NW <ZGET ,P-LEXV <+ .PTR ,P-LEXELEN>>>)
(T
<SET NW <>>)>
<COND (<AND <T? .DOLLAR>
<EQUAL? .NW ,W?PERIOD>
<G=? ,P-LEN:FIX 2>>
<SET TMP <CENTS-CHECK <+ .PTR <* ,P-LEXELEN 2>>>>
<COND (<T? .TMP>
<COND (<EQUAL? .TMP 100>
<SET TMP 0>)>
<SET SUM <+ <* 100 .SUM> .TMP>>
<SET CCTR <- ,P-LEN:FIX 2>>
<REPEAT ()
<COND (<L? <SET CCTR <- .CCTR 1>> 0>
<SETG P-LEN <- ,P-LEN:FIX 2>>
<PUTB ,P-LEXV ,P-LEXWORDS
<- <GETB ,P-LEXV ,P-LEXWORDS>:FIX
2>>
<RETURN>)>
<SET PTR <+ .PTR ,P-LEXELEN>>
<CHANGE-LEXV .PTR
<ZGET ,P-LEXV <+ .PTR <* 2 ,P-LEXELEN>>>>
<PUTB ,P-LEXV <+ <* .PTR 2> 2>
<GETB ,P-LEXV
<+ <* <+ .PTR <* 2 ,P-LEXELEN>> 2> 2>>>
<PUTB ,P-LEXV <+ <* .PTR 2> 3>
<GETB ,P-LEXV
<+ <* <+ .PTR <* 2 ,P-LEXELEN>> 2> 3>>>>)
(ELSE <SET SUM <* .SUM 100>>)>)
(<T? .DOLLAR> <SET SUM <* .SUM 100>>)>
<COND (<EQUAL? .NW ,W?CENT ,W?CENTS>
<SET DOLLAR T>)
(<INTBL? .NW <GETPT ,MONEY ,P?SYNONYM>
</ <PTSIZE <GETPT ,MONEY ,P?SYNONYM>> 2>>
; "Check synonyms from money object"
<SET DOLLAR T>
<SET SUM <* .SUM 100>>)>
<COND (<G? .SUM 9999>
<RETURN <> .NN>)
(<T? .EXC>
<SETG P-EXCHANGE .EXC>)
(<T? .TIM>
<SETG P-EXCHANGE 0>
<COND (<G? .TIM 23>
<RETURN <> .NN>)
(<G? .TIM 19>
T)
(<G? .TIM 12>
<RETURN <> .NN>)
(<G? .TIM 7>
T)
(T
<SET TIM <+ 12 .TIM>>)>
<SET SUM <+ .SUM <* .TIM 60>>>)
(T
<SETG P-EXCHANGE 0>)>
<COND (.MINUS?
<SETG P-EXCHANGE .EXC>
<SETG P-NUMBER .SUM>
<RETURN ,W?INTNUM>)>
<SETG P-DOLLAR-FLAG .DOLLAR>
<SETG P-NUMBER .SUM>
<COND (<AND <T? .DOLLAR>
<G? .SUM 0>>
<CHANGE-LEXV .SAVED-PTR ,W?MONEY>
,W?MONEY)
(T
<SETG P-DOLLAR-FLAG <>>
<SETG P-SEAT-NUMBER -1>
,W?INTNUM)>>
The block (at the end)
<COND (.MINUS?
<RETURN <>>)>
is replaced with:
<COND (.MINUS?
<SETG P-EXCHANGE .EXC>
<SETG P-NUMBER .SUM>
<RETURN ,W?INTNUM>)>
I can confirm this repairs the phone problem. Nice work! 👍 Still need to do a full playthrough to see if there are any side effects. Negative and hyphenated numbers are used in other spots, IIRC.
I've gone through the game a couple of times now, and I've not seen any side-effects of this patch yet. I was able to sit in seat 8-c
properly. Not sure what else should be tested, TBH.
I could be wrong, but running the official release 116 through txd I get the impression that this version didn't even have a MINUS?
variable. It is, of course, possible that it was added to address some sort of problem, but I'd be tempted to remove it completely.
I've tried this in two different interpreters now (Yazmin and my own), building the .z4 from source using ZILF/ZAPF. The game seems to play well (minus the currently logged problems) until it comes time to call the cab company. (this can be tested quickly at the beginning, just ignore the delivery agent at the front door, go west into the back room and try making a call)