QL Tinkering

Introduce yourself here!
User avatar
Outsoft
Super Gold Card
Posts: 695
Joined: Sat Apr 19, 2014 1:30 pm
Location: Italy
Contact:

Re: QL Tinkering

Post by Outsoft »

tcat wrote:Hi Qbits,

I have only now discovered your golf masterpiece. It is a great prog, not being a golfer gives me feeling of a real play.

I dared to touch your code a little, hope you may not mind.

[a] I converted CRLF line ending to be LF only
I renumbered the code
[c] I changed these lines

Setting device to mdv2_

Code: Select all

150 device_filename$="mdv2_QBGolf_data":REMark user device_filename
Sets all black background, WTV removed, 165 line added
EDIT: ch#2 set to console to allow program editing

Code: Select all

165 OPEN#2,con_:OPEN#1,scr_
170 MODE 4:WINDOW#0,372,62,134,192
Resolves problem with `out of range'

Code: Select all

1260 LOCal i,x,y,r,e,a:ch=4:BLOCK#ch,124,36,0,42,4
EDIT
Golf_close PROC: WTV,PAUSE removed, STOP added

Code: Select all

1880 MODE 4:PAPER 0:INK 7:PRINT,"Bye..."
1885 STOP
I would not know what to do with water hazard yet.

Attaching _bas after the above mods.
EDIT _bas updated
QBGolf.zip

Resulting in this, sincerely hoping that was your intention.
QBgolf.png

Cheers
Tom
Very nice!!!


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: QL Tinkering

Post by tcat »

Hi,

I played one full course, but water hazards never show. I am now reading brilliant documentation that comes with it, trying to understand better. By the way, it seems a very good introduction into game programming as well.

EDIT
I now changed these two lines in `Fairway' PROC pertaining to streams / lakes.

Code: Select all

2060 IF Gf(h,7)<=3:Stream
...
2080 IF Gf(h,7)=5 AND par<>3:Lake
There was a mistyped Gf index 8, but needs to be 7, as 7 is Randomly initialised here

Code: Select all

690  Gf(h,7)=RND(1 TO 5)                        :REMark Stream/Lake
I am now playing next course with water hazards shown.

Tomas


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: QL Tinkering

Post by tcat »

Hi,

I run `diff' on original (renumbered) and modified sources, hope is useful.

Code: Select all

tcat@lynx:~/mdv2$ diff QBGolf_bas QBGolf_org
6c6
< 150 device_filename$="mdv2_QBGolf_data":REMark user device_filename
---
> 150 device_filename$="flp1_QBGolf_data":REMark user device_filename
8,9c8
< 165 OPEN#2,con_:OPEN#1,scr_
< 170 MODE 4:WINDOW#0,372,62,134,192
---
> 170 MODE 4:WTV:WINDOW#0,372,62,134,192
46c45
< 540 IF k=27:Init_screens:Golf_close
---
> 540 IF k=27:Golf_close
118c117
< 1260 LOCal i,x,y,r,e,a:ch=4:BLOCK#ch,124,36,0,42,4
---
> 1260 LOCal i,x,y,r,e,a:ch=4:BLOCK#ch,126,36,0,44,4
180,181c179
< 1880 MODE 4:PAPER 0:INK 7:PRINT,"Bye..."
< 1885 STOP
---
> 1880 MODE 4:PAPER 0:INK 7:PRINT,"Bye...":PAUSE 50:WTV
199c197
< 2060 IF Gf(h,7)<=3:Stream
---
> 2060 IF Gf(h,8)<=3:Stream
201c199
< 2080 IF Gf(h,7)=5 AND par<>3:Lake
---
> 2080 IF Gf(h,8)=5 AND par<>3:Lake
QBGolf.zip
original + modified attached
(13.45 KiB) Downloaded 203 times

Tomas


qbits
Trump Card
Posts: 171
Joined: Sun Dec 11, 2016 3:32 pm

Re: QL Tinkering

Post by qbits »

Hi and happy NEW YEAR to one and all...

Vanpeebles, WRAP, dilwyn, Derek, Critian, Tcat, Outsoft - QL Tinkering was a deliberately chosen Topic title.
The feedback, suggested tweaks to getting the game running under a number of QL environments all to the good I feel. Please feel free to Tinker on.
I’m still in the process of investigating the SMSQmulator. I found a patch that has restored the missing top of the fairway channel #3 and titles.

Def Proc Golf_Game
Line WINDOW#ch,90,60,412,gy:Green (add ch=1) change to ch=1:WINDOW#ch,90,60,412,gy:Green

As to the Bunkers not being recognised???

For those who wish to speed up the Club swing
Def Proc Power
REPeat AP_lp
Line k=CODE(INKEY$(5)) [Change 5 for 1 :a 0 will cause the club and angle bars to flicker]
Line IF k=208:p=p+1 [change 1 for 4]
Line IF k=216:p=p -1 [change 1 for 4]

Again thank you for the support and advice already received.

So as NOT to out stay my welcome in this area of the forum, I think it prudent that I transfer my topic across to a more relevant section. Both for the receiving and giving I’m porting myself over to the Help for New Users area.

Over the coming weeks, months I hope to share more of my QBITS journey and a return to SuperBASIC programming.

Qbits


tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

Re: QL Tinkering

Post by tcat »

Hi qbits,

I am now tinkering your great prog on a real thing QL, QDOS v1.10.
ch=1 added.

I put -1 for INKEY$, meaning wait for a keypress.

Code: Select all

< 3070   k=CODE(INKEY$(-1))
---
> 3070   k=CODE(INKEY$(5))
For the swing, I added +4 step as suggested then also +8 step for the actual shot.

Code: Select all

< 3120   IF k=208:p=p+4:IF p>club:p=0
< 3130   IF k=216:p=p-4:IF p<0:p=0
---
> 3120   IF k=208:p=p+1:IF p>club:p=0
> 3130   IF k=216:p=p-1:IF p<0:p=0
308c306
< 3150     FOR a=0 TO p STEP 8
Running complete `diff' now gives:

Code: Select all

tcat@lynx:~/ql/sw/qbgolf$ diff QBGolf_bas QBGolf_org
6c6
< 150 device_filename$="mdv2_QBGolf_data":REMark user device_filename
---
> 150 device_filename$="flp1_QBGolf_data":REMark user device_filename
8,9c8
< 165 OPEN#2,con_:OPEN#1,scr_
< 170 MODE 4:WINDOW#0,372,62,134,192
---
> 170 MODE 4:WTV:WINDOW#0,372,62,134,192
46c45
< 540 IF k=27:Init_screens:Golf_close
---
> 540 IF k=27:Golf_close
53c52
< 610 ch=3:CURSOR#ch,72,154:CLS#ch,4:PRINT#ch,"Please wait - Initialising.."
---
> 610 ch=3:CURSOR#ch,72,154:CLS#ch,4:PRINT#ch,"Please wait - Initialsing.."
118c117
< 1260 LOCal i,x,y,r,e,a:ch=4:BLOCK#ch,124,36,0,42,4
---
> 1260 LOCal i,x,y,r,e,a:ch=4:BLOCK#ch,126,36,0,44,4
162c161
< 1700 ch=1:WINDOW#ch,90,60,412,gy:Green
---
> 1700  WINDOW#ch,90,60,412,gy:Green
180,181c179
< 1880 MODE 4:PAPER 0:INK 7:PRINT,"Bye..."
< 1885 STOP
---
> 1880 MODE 4:PAPER 0:INK 7:PRINT,"Bye...":PAUSE 50:WTV
199c197
< 2060 IF Gf(h,7)<=3:Stream
---
> 2060 IF Gf(h,8)<=3:Stream
201c199
< 2080 IF Gf(h,7)=5 AND par<>3:Lake
---
> 2080 IF Gf(h,8)=5 AND par<>3:Lake
300c298
< 3070   k=CODE(INKEY$(-1))
---
> 3070   k=CODE(INKEY$(5))
305,306c303,304
< 3120   IF k=208:p=p+4:IF p>club:p=0
< 3130   IF k=216:p=p-4:IF p<0:p=0
---
> 3120   IF k=208:p=p+1:IF p>club:p=0
> 3130   IF k=216:p=p-1:IF p<0:p=0
308c306
< 3150     FOR a=0 TO p STEP 8
---
> 3150     FOR a=0 TO p
EDIT, I also changed this line, so when at full swing does not come back to `0'.

Code: Select all

< 3120   IF k=208:p=p+4:IF p>club:p=club
---
> 3120   IF k=208:p=p+1:IF p>club:p=0
EDIT, updated
QBGolf.zip
QBits Golf Program Code
(13.46 KiB) Downloaded 189 times
P.S. I have not read the article in the magazine yet, just wondering what your real name is.
Thanks for sharing it here.
Tom


Post Reply