Author Topic: 3d fps game (Fulopke es az ellenallok)  (Read 6439 times)

0 Members and 1 Guest are viewing this topic.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
3d fps game (Fulopke es az ellenallok)
« on: November 29, 2019, 06:33:02 pm »
hi.

I am Toth Gyula from Hungary.
I make a FPS-game in QB64.

Try it. (zip in .bas)
THX.

download:
https://sharefiles.app/download/8c13890f42db97b4f21ba6c4420e29df0e3ddecf

little video:

https://www.youtube.com/watch?v=JJAAKUdcMX0

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #1 on: November 29, 2019, 06:39:53 pm »
Hey the youtube looks pretty good, better than anything I did in 3d,

welcome to the forum!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #2 on: November 30, 2019, 04:39:05 am »
It looks absolutely perfect. I downloaded your game, I recommend everyone to try. I like the camera capturing the scene from above at the end of the level, the dynamics of the game, attack of the small pyramids, time limited possibility of collecting things. The videos on billboards are also great. Since you are using MAPTRIANGLE2D, which is converted into 3D with the program, I think STxAxTIC will have a long time to talk about with you.
For me - it's absolutely amazing work!

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #3 on: November 30, 2019, 05:30:14 am »
Brilliant! It is one of the best 3D programs I have ever seen in QB64. Good job! :D
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #4 on: November 30, 2019, 07:22:39 am »
thanks for the comments, fine if you like it, a lot of work with it. at first I only needed a 3d rendering, then as I added it, it became more and more like a game.
then I put in a few things and then, obsessively, wanted to get something interesting out of it.
If you like, I'm happy.

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #5 on: November 30, 2019, 07:37:17 am »
BTW, if you use 7-zip, the size of the compressed file will be reduce to 136MB. ;)
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #6 on: November 30, 2019, 08:02:36 am »

727/5000
big file, yes. there are some files that are unnecessary but left there. the rest is advertising, textura. it was a big puzzle to adjust the difficulty of the different levels. lots of numbers determine difficulty. was eventually solved by the linear registry principle. but i'm curious about the partial results. menuneed \ jic.dat contains the amount of time it took for someone to complete a course. this is useful info for me to learn and fine-tune the linear difficulty. the game had a very small bug in it, here is the patch and "codelevel". this code is encrypted for how long someone got and exactly how many minutes he played.

https://sharefiles.app/download/e2d986fc4ea863274c4de2aaa1534e39aacf3210

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #7 on: November 30, 2019, 08:15:08 am »
A most excellent project, MasterGy. Whimsical, elegant, fast, addictive - the community needed this. The game is nice and hectic too.

It's been a long time coming, but it's probably about time we make a new spot on the forums for highly-developed games (and similar works) such as this. I'll make sure this doesn't get lost in forum history, that's for damn sure.
« Last Edit: November 30, 2019, 08:17:25 am by STxAxTIC »
You're not done when it works, you're done when it's right.

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #8 on: November 30, 2019, 02:18:02 pm »
I add my comment to the others

cool! very impressive.
It remembers me the universe in ASCII posted by STxAxTIC as model of engine 3D.
The video and images showed into pictures about arena are a fine and expert manner to show your ability. (At 1.00 of video we can see a love picture of 2018).
Have you made also the editor for your 3Dengine to create NPC and map of arena and object of the game?

Thanks to sharing
Programming isn't difficult, only it's  consuming time and coffee

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #9 on: December 01, 2019, 01:06:00 pm »
thank you! honored as you write about the game.
I made the course by taking a picture. I cut it into squares. the content of this image is the texture of the terrain, and the depth at a given point is determined by the grayscale of the image. black low, white high .
then the walls. palya.bmp contains info. red: out of sight. Blue Inner Walls White: Wall Green: Free space, here can be created umbrellas, random enemies.
based on palya.bmp, with another program, I create columns at a uniform distance that I delete in a file. this is the wall. this is fal.dat
then externally, for easier calibration, the height of the walls is determined by falmagassag.dat.
the first two values ​​are the height of the outer walls low / high, and the third value is the fixed height of the inner walls. (fixed because it is easier to calculate than projectile projectiles)

other...
I don't know if I'm interested ... I figured out a way to create music by algorithm. translate it if you find it interesting.

It was written in qb64

http://tukorgravirozas.fw.hu/mastergy/5hang/index.html
http://tukorgravirozas.fw.hu/mastergy/algzene/index.html

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #10 on: December 01, 2019, 03:34:56 pm »
This is absolutely stunning. Algorithm music! Could it be something like MOD, XM, S3M sound format? Does this mean that a part of the WAV file is taken (in MOD format, it is 8 bit mono audio files that consist of samples that are then played back by recording in the MOD file)? The QB64 gives you enormous audio experiments. If you do not want to waste time writing a decoder, you can immediately start other experimetny with WAV audio files using the _SNDRAW command. You can create a sound mixer where you take part of the sound and play it here repeatedly. Or add an echo effect. All with smooth volume control. Somewhere in the old forum, which no longer works, was even an example where a programmer directly for this command, using mathematics wrote the algorithm of the electric guitar. Unfortunately this source code is no longer available.

https://www.qb64.org/forum/index.php?topic=1830.0
https://www.qb64.org/forum/index.php?topic=305.0     <---  press E with mouse in program for activate echo effect.

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #11 on: December 01, 2019, 03:53:51 pm »
thank you petr! no, it has nothing to do with any format. midi is just a tool for directly speaking the results of operations. uses windows midi and recorded it in wav. the program needs nothing but midi. and I can write it with a .lib from qb64.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #12 on: December 01, 2019, 04:17:13 pm »
Well, I would like to look at some simple example of such use. So if you are so kind and add something easy, I will be happy to see it! Thank you.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #13 on: December 01, 2019, 07:24:49 pm »
Hi

Don't know if the attachments are of any relevance (may only cloud the issue).

Offline MasterGy

  • Seasoned Forum Regular
  • Posts: 327
  • people lie, math never lies
    • View Profile
Re: 3d fps game (Fulopke es az ellenallok)
« Reply #14 on: December 02, 2019, 12:28:38 am »

This is the program.
Calculates from the bits of the resulting bands what sounds and at what pitch.

I'll write in more detail later if you wish. For now, if you press the R button, new music is always created. the values can be adjusted with the mouse using the left and right buttons and the scroll wheel.




Code: QB64: [Select]
  1. DEFLNG A-Z
  2. TYPE FILEDIALOGTYPE
  3.     lStructSize AS LONG '        For the DLL call
  4.     hwndOwner AS LONG '          Dialog will hide behind window when not set correctly
  5.     hInstance AS LONG '          Handle to a module that contains a dialog box template.
  6.     lpstrFilter AS _OFFSET '     Pointer of the string of file filters
  7.     lpstrCustFilter AS _OFFSET
  8.     nMaxCustFilter AS LONG
  9.     nFilterIndex AS LONG '       One based starting filter index to use when dialog is called
  10.     lpstrFile AS _OFFSET '       String full of 0's for the selected file name
  11.     nMaxFile AS LONG '           Maximum length of the string stuffed with 0's minus 1
  12.     lpstrFileTitle AS _OFFSET '  Same as lpstrFile
  13.     nMaxFileTitle AS LONG '      Same as nMaxFile
  14.     lpstrInitialDir AS _OFFSET ' Starting directory
  15.     lpstrTitle AS _OFFSET '      Dialog title
  16.     flags AS LONG '              Dialog flags
  17.     nFileOffset AS INTEGER '     Zero-based offset from path beginning to file name string pointed to by lpstrFile
  18.     nFileExtension AS INTEGER '  Zero-based offset from path beginning to file extension string pointed to by lpstrFile.
  19.     lpstrDefExt AS _OFFSET '     Default/selected file extension
  20.     lCustData AS LONG
  21.     lpfnHook AS LONG
  22.     lpTemplateName AS _OFFSET
  23.  
  24. DECLARE DYNAMIC LIBRARY "comdlg32" ' Library declarations using _OFFSET types
  25.     FUNCTION GetOpenFileNameA& (DIALOGPARAMS AS FILEDIALOGTYPE) ' The Open file dialog
  26.     FUNCTION GetSaveFileNameA& (DIALOGPARAMS AS FILEDIALOGTYPE) ' The Save file dialog
  27.  
  28.     FUNCTION FindWindow& (BYVAL ClassName AS _OFFSET, WindowName$) ' To get hWnd handle
  29.  
  30.     FUNCTION midiOutGetNumDevs (numdevs AS INTEGER)
  31.     FUNCTION midiOutOpen (lphMidiOut AS LONG, BYVAL uDeviceID AS LONG, BYVAL dwCallback AS LONG, BYVAL dwInstance AS LONG, BYVAL dwFlags AS LONG)
  32.     FUNCTION midiOutClose (BYVAL hMidiOut AS LONG)
  33.     FUNCTION midiOutShortMsg (BYVAL hMidiOut AS LONG, BYVAL dwMsg AS LONG)
  34.  
  35. _TITLE "ALGORITMUS-ZENE (TOTH GYULA 2019) "
  36. CLS: REM GOSUB masolasvedelem
  37. prog1 = _NEWIMAGE(1200, 1100, 32): SCREEN prog1
  38. prog2 = _NEWIMAGE(400, 80, 32)
  39.  
  40.  
  41. DIM par$(99), par(99, 2), bill$(99, 1), utolsohang(99), utolsohangszer(99)
  42. DIM aktiv1 AS LONG, aktiv2 AS LONG
  43.  
  44. DIM utos(99, 19), poli(99, 19), sav(99, 19), csend(99)
  45. DIM kuld AS LONG
  46. DIM hmidiout AS LONG
  47. DIM midi$(255), savok$(99)
  48. DIM x(9999)
  49. DIM mmidi AS LONG, keret AS LONG
  50. DIM aktivsav(99), savmutatakt(99), polimutatakt(99), utosmutatakt(99)
  51. DIM keszlet(99, 3)
  52. DIM hangref$(255), hangnev$(11)
  53. DIM aktivkeszlet(11)
  54.  
  55. sv$ = "ver1"
  56.  
  57. GOSUB hangdec
  58.  
  59. REM DIM mauzx AS _FLOAT, mauzy AS _FLOAT
  60. helpmutat = 1
  61. aktiv2 = _RGB32(194, 161, 133)
  62. aktiv1 = _RGB32(255, 255, 255)
  63. keret = aktiv2
  64.  
  65. dobszel$ = "1114112022233637394344"
  66. a$(0) = STRING$(10000, ".")
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. x(0) = 2
  74. x(1) = 70
  75. x(2) = 81
  76. x(20) = 25: REM savok szama
  77. x(21) = 1: REM haladas iranya, szorzoja
  78. x(22) = 0: REM aktualis leptek-pozicio
  79. x(23) = 2: REM metronom szorzo
  80. x(24) = 0: REM ennyi aktiv sav van, ezt majd a program tolti ki (savinst)
  81. x(25) = 4000: REM savhossz
  82. x(30) = 8: REM ennyi polifonikus hangszer
  83. x(31) = 8: REM ennyi utos hangszer
  84. x(32) = 5: REM polifonikus jelfogok-szama
  85. x(33) = 5: REM hangkeszlet 2 ennyediken
  86. x(34) = 1: REM sorozat aktualis ertek szorzoja
  87. x(35) = 45: REM tempo
  88. x(36) = 3: REM sorozat tag1
  89. x(37) = 5: REM sorozat tag2
  90. x(38) = 100: REM sorozat szorzo
  91. x(39) = 0: REM hangszer lecsengese
  92.  
  93. REM UTOS tomb : a,b  a-melyik sav
  94. REM b-0: aktiv-e b-1:hangszer:c-1:hangero
  95.  
  96. REM 1.param : (0) = kussol (1)=utos (2) = polifonikus
  97. sx = 1: sy = 1
  98. RANDOMIZE TIMER: GOSUB miditest: GOSUB midiinst
  99.  
  100.  
  101. GOSUB billdec
  102. GOSUB decparam
  103. GOSUB randaktivkeszlet
  104. GOSUB randaktivhangdec
  105. GOSUB randrendeles
  106. GOSUB newsavinst
  107. GOSUB hangokdec
  108. GOSUB savdec
  109. GOSUB keszletdec
  110. GOSUB polidec: GOSUB randpoli
  111. GOSUB utosdec: GOSUB randutos
  112. GOSUB pre
  113.  
  114. GOSUB randhangsor5
  115. GOSUB sorrendrendeles
  116. GOSUB randoktkeszlet
  117. GOSUB randpolixoktav
  118.  
  119.  
  120. IF _FILEEXISTS("last.alg") THEN fajlnev$ = "last.alg": GOSUB zenebetoltese
  121.  
  122.  
  123.     _LIMIT x(35) / 5
  124.     REM    _DISPLAY
  125.  
  126.  
  127.     bill$ = LCASE$(INKEY$)
  128.  
  129.     SELECT CASE bill$
  130.         CASE CHR$(27): GOSUB midizar: fajlnev$ = "last.alg": GOSUB zenementese: SYSTEM
  131.         CASE bill$(0, 0): aleptek = 0
  132.         CASE bill$(1, 0): GOSUB savtxtadd: GOSUB randutos
  133.         CASE bill$(2, 0): GOSUB utoshangszerrand
  134.         CASE bill$(3, 0): GOSUB savtxtadd: GOSUB randpoli
  135.         CASE bill$(4, 0): GOSUB savtxtadd: GOSUB randpolixhangszer
  136.         CASE bill$(5, 0): GOSUB savtxtadd: GOSUB randpolixoktav
  137.         CASE bill$(6, 0): GOSUB savtxtadd: GOSUB randpolivtrack
  138.         CASE bill$(7, 0): GOSUB commn
  139.         CASE bill$(8, 0): GOSUB savtxtadd: GOSUB randomsorozat
  140.         CASE bill$(9, 0): GOSUB randaktivhangdec
  141.         CASE bill$(10, 0): GOSUB randaktivkeszlet
  142.         CASE bill$(11, 0): GOSUB randrendeles
  143.         CASE bill$(12, 0): GOSUB sorrendrendeles
  144.         CASE bill$(13, 0): GOSUB randhangsor5
  145.         CASE bill$(14, 0): GOSUB randhangsor7
  146.         CASE bill$(15, 0): helpmutat = helpmutat XOR 1
  147.         CASE bill$(16, 0): GOSUB keszletminta4bit
  148.         CASE bill$(17, 0): GOSUB randoktkeszlet
  149.         CASE bill$(18, 0): GOSUB midizar: GOSUB inakt: fajlnev$ = "uj": GOSUB zenementese2: RUN
  150.         CASE bill$(19, 0): GOSUB midizar: GOSUB inakt: fajlnev$ = "uj": GOSUB zenebetoltese: fajlnev$ = "last.alg": GOSUB zenementese: RUN
  151.         CASE bill$(20, 0): GOSUB visszaallit: GOSUB midizar: RUN
  152.     END SELECT
  153.  
  154.     aktiv$ = ""
  155.     CLS
  156.     ykpoli = 24 + x(24) - 16: xkpoli = 5
  157.     ykkeszlet = 24 + x(24) - 16: xkkeszlet = 64
  158.     yksav = 4: xksav = 5
  159.     ykutos = yksav: xkutos = 70 - 6
  160.     ykhangk = ykpoli: xkhangk = 96
  161.     GOSUB parammutat
  162.     IF x(32) THEN GOSUB hangokmutat
  163.     GOSUB savaktdel
  164.     GOSUB utosmutat
  165.     GOSUB utosaktdel
  166.  
  167.     GOSUB polimutat
  168.     GOSUB poliaktdel
  169.     GOSUB savmutat
  170.     IF x(32) THEN GOSUB keszletmutat
  171.  
  172.     COLOR _RGB32(255, 255, 255): LINE (900, 0)-(900, 1100)
  173.     IF (_KEYDOWN(100303) OR _KEYDOWN(100304)) OR helpmutat THEN GOSUB billmutat
  174.     _DISPLAY
  175.     egergorgo = 0: FOR t = 0 TO 200:
  176.  
  177.         q = _MOUSEINPUT: mauzx = (_MOUSEX / 8) + 1: mauzy = (_MOUSEY / 16) + 1:
  178.         egergorgo = _MOUSEWHEEL + egergorgo
  179.     NEXT t
  180.     egergorgo = SGN(egergorgo)
  181.     IF LEN(aktiv$) THEN GOSUB akciokezelo
  182.     REM GOSUB midihangszer
  183.     REM     GOSUB feltcsend
  184.     IF x(32) THEN GOSUB midipolion
  185.     GOSUB szolalutos
  186.     IF x(23) THEN GOSUB metronom
  187.     x(22) = aleptek * x(34) + 1600
  188.     aleptek = aleptek + 1
  189.     SELECT CASE x(32)
  190.         CASE 0: x(33) = 0
  191.         CASE 1: x(33) = 1
  192.         CASE 2: x(33) = 2
  193.         CASE 3: x(33) = 3
  194.         CASE 4: x(33) = 4
  195.         CASE 5: x(33) = 5
  196.     END SELECT
  197.  
  198.  
  199. inakt:
  200. PRINT "inaktiv, ne zard be !": RETURN
  201.  
  202.  
  203.  
  204. visszaallit: IF _FILEEXISTS("last.alg") THEN KILL "last.alg"
  205.  
  206. billdec:
  207. bill$(0, 0) = "0": bill$(0, 1) = "sorozat kezdoponta allitas"
  208. bill$(1, 0) = "q": bill$(1, 1) = "utoshangszerek random hangszerei"
  209. bill$(2, 0) = "w": bill$(2, 1) = "utoshangszerek random SAV-jai"
  210. bill$(3, 0) = "y": bill$(3, 1) = "polihangszerek random ertekek"
  211. bill$(4, 0) = "x": bill$(4, 1) = "polihangszerek random hangszerei"
  212. bill$(5, 0) = "c": bill$(5, 1) = "polihangszerek random oktavok"
  213. bill$(6, 0) = "v": bill$(6, 1) = "polihangszerek random savjai"
  214. bill$(7, 0) = "n": bill$(7, 1) = "polihangszerek egyforma 2 track"
  215. bill$(8, 0) = "a": bill$(8, 1) = "random sorozat eloallitasa"
  216. bill$(9, 0) = "1": bill$(9, 1) = "keszlet random aktivizalasa"
  217. bill$(10, 0) = "2": bill$(10, 1) = "alapkeszlet random aktivizalasa"
  218. bill$(11, 0) = "3": bill$(11, 1) = "random hangkeszlethez rendeles"
  219. bill$(12, 0) = "4": bill$(12, 1) = "rendezett hangkeszlethez rendeles"
  220. bill$(13, 0) = "5": bill$(13, 1) = "5-foku hangsor betoltes"
  221. bill$(14, 0) = "7": bill$(14, 1) = "7-foku hangsor betoltes"
  222. bill$(15, 0) = "h": bill$(15, 1) = "HELP - billentyuzet funkciok"
  223. bill$(16, 0) = "8": bill$(16, 1) = "keszlet aktiv 4 bit minta alapjan"
  224. bill$(17, 0) = "s": bill$(17, 1) = "random oktav keszlet"
  225. bill$(18, 0) = "p": bill$(18, 1) = "zene mentese"
  226. bill$(19, 0) = "o": bill$(19, 1) = "zene betoltese"
  227. bill$(20, 0) = "r": bill$(20, 1) = "RESET, mindent alapertekre"
  228.  
  229.  
  230.  
  231. billmutat: xx = 0: FOR t = 0 TO 99
  232.     IF LEN(bill$(t, 0)) THEN
  233.         xx = xx + 1
  234.         LOCATE xx, 1: PRINT SPACE$(45)
  235.         LOCATE xx, 1: PRINT UCASE$(bill$(t, 0)) + " - "; bill$(t, 1)
  236.     END IF
  237.  
  238.  
  239.  
  240. szolalutos: FOR t = 0 TO x(31) - 1
  241.  
  242.     aktualsav = aktivsav(utos(t, 3))
  243.  
  244.     eltolas = sav(aktualsav, 1)
  245.     ae = MID$(savok$(aktualsav), x(22) + 1 + eltolas, 1) = bit$(1)
  246.     IF ae AND utos(t, 0) THEN
  247.         kuld = &H7F0099: mmidi = utos(t, 1) + 35
  248.         kuld = kuld OR ((mmidi AND 255) * 256)
  249.         q = midiOutShortMsg(hmidiout, kuld): IF q THEN END
  250.     END IF
  251.  
  252.  
  253.  
  254. savaktdel: FOR t = 0 TO 99: savmutatakt(t) = 0: NEXT t: RETURN
  255. poliaktdel: FOR t = 0 TO 99: polimutatakt(t) = 0: NEXT t: RETURN
  256. utosaktdel: FOR t = 0 TO 99: utosmutatakt(t) = 0: NEXT t: RETURN
  257.  
  258. akciokezelo:
  259. modosit = -egergorgo
  260. IF _MOUSEBUTTON(1) = 0 AND _MOUSEBUTTON(2) = 0 THEN mbm = 0
  261. IF _MOUSEBUTTON(1) AND mbm = 0 THEN modosit = -1: mbm = 1
  262. IF _MOUSEBUTTON(2) AND mbm = 0 THEN modosit = 1: mbm = 1
  263.  
  264. IF modosit THEN
  265.     SELECT CASE aktiv$
  266.         CASE "parameterek"
  267.             mx0 = par(aktivp1, 0)
  268.             modositott2 = x(mx0) + modosit
  269.             felt = modositott2 >= par(aktivp1, 1) AND modositott2 <= par(aktivp1, 2)
  270.             IF felt AND mx0 = 30 THEN GOSUB csend
  271.             IF felt THEN x(mx0) = modositott2
  272.             IF felt AND mx0 = 24 THEN GOSUB utoshangszerrand: GOSUB randpolivtrack
  273.         CASE "utosparam"
  274.  
  275.             utos(aktivp1, aktivp2) = utos(aktivp1, aktivp2) + modosit
  276.             utos(aktivp1, 0) = ABS(utos(aktivp1, 0)) AND 1
  277.  
  278.  
  279.  
  280.             IF utos(aktivp1, 2) > 127 THEN utos(aktivp1, 2) = 0
  281.             IF utos(aktivp1, 2) < 0 THEN utos(aktivp1, 2) = 127
  282.             IF utos(aktivp1, 1) > 45 THEN utos(aktivp1, 1) = 0
  283.             IF utos(aktivp1, 1) < 0 THEN utos(aktivp1, 1) = 45
  284.  
  285.             IF utos(aktivp1, 3) >= x(24) THEN utos(aktivp1, 3) = 0
  286.             IF utos(aktivp1, 3) < 0 THEN utos(aktivp1, 3) = x(24) - 1
  287.         CASE "aktivhangok"
  288.             IF modosit THEN aktivkeszlet(aktivp1) = aktivkeszlet(aktivp1) XOR 1
  289.         CASE "poliparam"
  290.  
  291.  
  292.             poli(aktivp1, aktivp2) = poli(aktivp1, aktivp2) + modosit
  293.             poli(aktivp1, 0) = ABS(poli(aktivp1, 0)) AND 1
  294.             IF poli(aktivp1, 1) > 127 THEN poli(aktivp1, 1) = 0
  295.             IF poli(aktivp1, 1) < 0 THEN poli(aktivp1, 1) = 127
  296.             IF poli(aktivp1, 2) > 127 THEN poli(aktivp1, 2) = 0
  297.             IF poli(aktivp1, 2) < 0 THEN poli(aktivp1, 2) = 127
  298.             IF poli(aktivp1, 8) > 4 THEN poli(aktivp1, 8) = 4
  299.             IF poli(aktivp1, 8) < -4 THEN poli(aktivp1, 8) = -4
  300.  
  301.             FOR t3 = 3 TO 6
  302.                 IF poli(aktivp1, t3) > (x(24) - 1) THEN poli(aktivp1, t3) = 0
  303.                 IF poli(aktivp1, t3) < 0 THEN poli(aktivp1, t3) = x(24) - 1
  304.             NEXT t3
  305.         CASE "keszlet"
  306.            55: keszlet(aktivp1, aktivp2) = keszlet(aktivp1, aktivp2) + modosit
  307.  
  308.  
  309.  
  310.             keszlet(aktivp1, 1) = ABS(keszlet(aktivp1, 1)) AND 1
  311.             IF keszlet(aktivp1, 3) > 4 THEN keszlet(aktivp1, 3) = 4
  312.             IF keszlet(aktivp1, 3) < -4 THEN keszlet(aktivp1, 3) = -4
  313.             IF keszlet(aktivp1, 2) > 11 THEN keszlet(aktivp1, 2) = 0
  314.             IF keszlet(aktivp1, 2) < 0 THEN keszlet(aktivp1, 2) = 11
  315.             IF (aktivkeszlet(keszlet(aktivp1, 2)) = 0) AND (aktivp2 = 2) THEN GOTO 55
  316.  
  317.  
  318.         CASE "savparam"
  319.             sav(aktivp1, aktivp2) = sav(aktivp1, aktivp2) + modosit
  320.             sav(aktivp1, 2) = ABS(sav(aktivp1, 2)) AND 1
  321.             IF sav(aktivp1, 1) > 9 THEN sav(aktivp1, 1) = 9
  322.             IF sav(aktivp1, 1) < -9 THEN sav(aktivp1, 1) = -9
  323.  
  324.  
  325.     END SELECT
  326. GOTO 77
  327. FOR t = 0 TO 2 ^ x(33) - 1
  328.     IF aktivkeszlet(keszlet(t, 2)) = 0 THEN keszlet(t, 1) = 0
  329. 77
  330.  
  331.  
  332.  
  333.  
  334.  
  335. newsavinst: CLS: REDIM anali(999): x(22) = 0: aleptek = 0: REM aktualis lepes 1-ra
  336. FOR t = 0 TO x(20) - 1: savok$(t) = STRING$(14, "."): NEXT t
  337. FOR alep = 0 TO x(25) - 1: ertek = (x(1) * alep) AND (x(2) * alep)
  338.     FOR t = 0 TO x(20) - 1: bit = SGN((2 ^ t) AND ertek)
  339.     savok$(t) = savok$(t) + bit$(bit): anali(t) = anali(t) + bit: NEXT t
  340. NEXT alep
  341. aktivsavdb = 0: FOR t = 0 TO x(20) - 1
  342.     IF anali(t) THEN aktivsav(aktivsavdb) = t: aktivsavdb = aktivsavdb + 1
  343. NEXT t: x(24) = aktivsavdb
  344.  
  345.  
  346. REM anali fejlec
  347. REM 0-aktiv sav (ezt majd a program tolti ki)
  348. REM 1-osszes 1-es
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355. savtxtadd: FOR t = 0 TO x(20): savok$(t) = MID$(savok$(t), 2) + "*": NEXT t: RETURN
  356.  
  357. randomsorozat:
  358. REM 3,11 jo !
  359.  
  360. alap = INT(x(38) * RND(1)): x(1) = alap * x(36): x(2) = alap * x(37)
  361. GOTO newsavinst
  362.  
  363.  
  364.  
  365. pre: FOR t = 0 TO 99: utos(t, 0) = 1: utos(t, 2) = 127: NEXT t: RETURN
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396. midiinst:
  397. midi$(0) = "AcousticGrandPiano"
  398. midi$(1) = "BrightAcousticPiano"
  399. midi$(2) = "ElectricGrandPiano"
  400. midi$(3) = "Honky-tonkPiano"
  401. midi$(4) = "ElectricPiano1"
  402. midi$(5) = "ElectricPiano2"
  403. midi$(6) = "Harpsichord"
  404. midi$(7) = "Clavi"
  405. midi$(8) = "Celesta"
  406. midi$(9) = "Glockenspiel"
  407. midi$(10) = "MusicBox"
  408. midi$(11) = "Vibraphone"
  409. midi$(12) = "Marimba"
  410. midi$(13) = "Xylophone"
  411. midi$(14) = "TubularBells"
  412. midi$(15) = "Dulcimer"
  413. midi$(16) = "DrawbarOrgan"
  414. midi$(17) = "PercussiveOrgan"
  415. midi$(18) = "RockOrgan"
  416. midi$(19) = "ChurchOrgan"
  417. midi$(20) = "ReedOrgan"
  418. midi$(21) = "Accordion"
  419. midi$(22) = "Harmonica"
  420. midi$(23) = "TanaoAccordion"
  421. midi$(24) = "AcousticGuitar(nylon)"
  422. midi$(25) = "AcousticGuitar(steel)"
  423. midi$(26) = "ElectricGuitar(jazz)"
  424. midi$(27) = "ElectricGuitar(clean)"
  425. midi$(28) = "ElectricGuitar(muted)"
  426. midi$(29) = "OverdrivenGuitar"
  427. midi$(30) = "DistortionGuitar"
  428. midi$(31) = "Guitarharmonics"
  429. midi$(32) = "AcousticBass"
  430. midi$(33) = "ElectricBass(finger)"
  431. midi$(34) = "ElectricBass(pick)"
  432. midi$(35) = "FretlessBass"
  433. midi$(36) = "SlapBass1"
  434. midi$(37) = "SlapBass2"
  435. midi$(38) = "SynthBass1"
  436. midi$(39) = "SynthBass2"
  437. midi$(40) = "Violin"
  438. midi$(41) = "Viola"
  439. midi$(42) = "Cello"
  440. midi$(43) = "Contrabass"
  441. midi$(44) = "TremoloStrings"
  442. midi$(45) = "PizzicatoStrinqs"
  443. midi$(46) = "OrchestralHarp"
  444. midi$(47) = "Timpani"
  445. midi$(48) = "StringEnsemble1"
  446. midi$(49) = "StringEnsemble2"
  447. midi$(50) = "SynthStrings1"
  448. midi$(51) = "SynthStrings2"
  449. midi$(52) = "ChoirAahs"
  450. midi$(53) = "VoiceOohs"
  451. midi$(54) = "SynthVoice"
  452. midi$(55) = "OrchestraHit"
  453. midi$(56) = "Trumpet"
  454. midi$(57) = "Trombone"
  455. midi$(58) = "Tuba"
  456. midi$(59) = "MutedTrumpet"
  457. midi$(60) = "FrenchHorn"
  458. midi$(61) = "BrassSection"
  459. midi$(62) = "SynthBrass1"
  460. midi$(63) = "SynthBrass2"
  461. midi$(64) = "SopranoSax"
  462. midi$(65) = "AltoSax"
  463. midi$(66) = "Tenor"
  464. midi$(67) = "BaritoneSax"
  465. midi$(68) = "Oboe"
  466. midi$(69) = "EnglishHorn"
  467. midi$(70) = "Bassoon"
  468. midi$(71) = "Clarinet"
  469. midi$(72) = "Piccolo"
  470. midi$(73) = "Flute"
  471. midi$(74) = "Recorder"
  472. midi$(75) = "PanFlute"
  473. midi$(76) = "BlownBottle"
  474. midi$(77) = "Shakuhachi"
  475. midi$(78) = "Whistle"
  476. midi$(79) = "Ocarina"
  477. midi$(80) = "Lead1(square)"
  478. midi$(81) = "Lead2(saw)"
  479. midi$(82) = "Lead3(calliope)"
  480. midi$(83) = "Lead4(chill)"
  481. midi$(84) = "Lead5(charanq)"
  482. midi$(85) = "Lead6(voice)"
  483. midi$(86) = "Lead7(fifths)"
  484. midi$(87) = "Lead8(bass+lead)"
  485. midi$(88) = "Pad1(newage)"
  486. midi$(89) = "Pad2(warm)"
  487. midi$(90) = "Pad3(polysynth)"
  488. midi$(91) = "Pad4(choir)"
  489. midi$(92) = "Pad5(bowed)"
  490. midi$(93) = "Pad6(metallic)"
  491. midi$(94) = "Pad7(halo)"
  492. midi$(95) = "Pad8(sweep)"
  493. midi$(96) = "FX1(rain)"
  494. midi$(97) = "Fx2%(soundtrack)"
  495. midi$(98) = "FX3(crystal)"
  496. midi$(99) = "FX(Athmosphere)"
  497. midi$(100) = "FX5(brightness)"
  498. midi$(101) = "FX6(goblins)"
  499. midi$(102) = "FX7(echoes)"
  500. midi$(103) = "FX8(sci-li)"
  501. midi$(104) = "Sitar"
  502. midi$(105) = "Banjo"
  503. midi$(106) = "Shamisen"
  504. midi$(107) = "Koto"
  505. midi$(108) = "Kalimba"
  506. midi$(109) = "Bagpipe"
  507. midi$(110) = "Fiddie"
  508. midi$(111) = "Shanai"
  509. midi$(112) = "TinkleBell"
  510. midi$(113) = "Agogo"
  511. midi$(114) = "SteelDrums"
  512. midi$(115) = "Woodblock"
  513. midi$(116) = "TaikoDrum"
  514. midi$(117) = "MelodicTom"
  515. midi$(118) = "SynthDrum"
  516. midi$(119) = "ReverseCymbal"
  517. midi$(120) = "GuitarFretNoise"
  518. midi$(121) = "BreathNoise"
  519. midi$(122) = "Seashore"
  520. midi$(123) = "BirdTweet"
  521. midi$(124) = "TelephoneRing"
  522. midi$(125) = "Helicopter"
  523. midi$(126) = "Applause"
  524. midi$(127) = "Gunshot"
  525. midi$(128) = "AcousticBassDrum"
  526. midi$(129) = "BassDrum1"
  527. midi$(130) = "SideStick"
  528. midi$(131) = "AcousticSnare"
  529. midi$(132) = "HandClap"
  530. midi$(133) = "ElectricSnare"
  531. midi$(134) = "LowFloorTom"
  532. midi$(135) = "ClosedHi-Hat"
  533. midi$(136) = "HighFloorTom"
  534. midi$(137) = "PedalHi-Hat"
  535. midi$(138) = "LowTom"
  536. midi$(139) = "OpenHi-Hat"
  537. midi$(140) = "Low-MidTom"
  538. midi$(141) = "Hi-MidTom"
  539. midi$(142) = "CrashCymbal1"
  540. midi$(143) = "HighTom"
  541. midi$(144) = "RideCymbal1"
  542. midi$(145) = "ChineseCymbal"
  543. midi$(146) = "RideBell"
  544. midi$(147) = "Tambourine"
  545. midi$(148) = "SplashCymbal"
  546. midi$(149) = "Cowbell"
  547. midi$(150) = "CrashCymbal2"
  548. midi$(151) = "Vibraslap"
  549. midi$(152) = "RideCymbal2"
  550. midi$(153) = "HiBongo"
  551. midi$(154) = "LowBongo"
  552. midi$(155) = "MuteHiConga"
  553. midi$(156) = "OpenHiConga"
  554. midi$(157) = "LowConga"
  555. midi$(158) = "HighTimbale"
  556. midi$(159) = "LowTimbale"
  557. midi$(160) = "HighAgogo"
  558. midi$(161) = "LowAgogo"
  559. midi$(162) = "Cabasa"
  560. midi$(163) = "Maracas"
  561. midi$(164) = "ShortWhistle"
  562. midi$(165) = "LongWhistle"
  563. midi$(166) = "ShortGuiro"
  564. midi$(167) = "LongGuiro"
  565. midi$(168) = "Claves"
  566. midi$(169) = "HiWoodBlock"
  567. midi$(170) = "LowWoodBlock"
  568. midi$(171) = "MuteCuica"
  569. midi$(172) = "OpenCuica"
  570. midi$(173) = "MuteTriangle"
  571. midi$(174) = "OpenTriangle"
  572. bit$(0) = ".": bit$(1) = "Ű"
  573. miditest:
  574.  
  575. hmidiout = 0
  576. q = midiOutGetNumDevs(0): PRINT "MIDI-eszkozokok szama:"; q
  577. IF q = 0 THEN PRINT "nincs MIDI-eszkoz": END
  578.  
  579. q = midiOutOpen(hmidiout, 0, 0, 0, 0): IF q THEN PRINT "MIDI-t nem sikerult megnyitni": END
  580. PRINT "MIDI megnyitva"
  581. REM ---------------------
  582.  
  583.  
  584.  
  585.  
  586.  
  587. ch = 9
  588.  
  589. kuld = &H0020C0 + ch
  590. q = midiOutShortMsg(hmidiout, kuld)
  591.  
  592. kuld = &H7F2C90 + ch
  593. q = midiOutShortMsg(hmidiout, kuld)
  594.  
  595.  
  596. kuld = &HFF2C80 + ch
  597. q = midiOutShortMsg(hmidiout, kuld)
  598.  
  599. midizar: q = midiOutClose(hmidiout): RETURN
  600.  
  601.  
  602. metronom: ms1 = x(23): ms2 = ms1 * 2: ms4 = ms1 * 4
  603. mdob = (aleptek / ms2) = INT(aleptek / ms2): IF mdob = 0 THEN mdoba = 0
  604. mccc = ((aleptek + ms1) / ms2) = INT((aleptek + ms1) / ms2): IF mccc = 0 THEN mccca = 0
  605. mdzs = ((aleptek + ms2) / ms4) = INT((aleptek + ms2) / ms4): IF mdzs = 0 THEN mdzsa = 0
  606. IF mdob AND mdoba = 0 THEN q = midiOutShortMsg(hmidiout, &H7F0099 OR (35 * 256)): mdoba = 1
  607. IF mdzs AND mdzsa = 0 THEN q = midiOutShortMsg(hmidiout, &H7F0099 OR (38 * 256)): mdzsa = 1
  608. IF mccc AND mccca = 0 THEN q = midiOutShortMsg(hmidiout, &H7F0099 OR (44 * 256)): mccca = 1
  609.  
  610.  
  611.  
  612. randpoli:
  613.  
  614. GOSUB randpolivtrack: GOSUB randpolixhangszer: GOSUB randpolixoktav: RETURN
  615.  
  616. randpolixhangszer: FOR t = 0 TO 99: poli(t, 1) = INT(128 * RND(1)): NEXT t: RETURN
  617. randpolixoktav: FOR t = 0 TO 99: poli(t, 8) = INT(4 * RND(1)) - 2: NEXT t: RETURN
  618. randpolivtrack: FOR t = 0 TO 99:
  619.     poli(t, 3) = INT(x(24) * RND(1))
  620.     poli(t, 4) = INT(x(24) * RND(1))
  621.     poli(t, 5) = INT(x(24) * RND(1))
  622.     poli(t, 6) = INT(x(24) * RND(1))
  623.     poli(t, 7) = INT(x(24) * RND(1))
  624.  
  625. commn:
  626. q = INT(x(24) * RND(1))
  627. q2 = INT(x(24) * RND(1))
  628.  
  629. FOR t = 0 TO 99
  630.     q3 = INT(x(24) * RND(1) * .7)
  631.     poli(t, 3) = q3
  632.     poli(t, 4) = q3 + 1
  633.     poli(t, 5) = q
  634.     poli(t, 6) = q2
  635.     poli(t, 7) = q3 + 2
  636.  
  637.  
  638.  
  639. randutos: FOR t = 0 TO 99: utos(t, 1) = INT(46 * RND(1)): NEXT t: RETURN
  640.  
  641. hangokdec:
  642. hn$(0) = "akt "
  643. hn$(1) = "hang "
  644.  
  645. polidec:
  646. pn$(0) = "akt "
  647. pn$(1) = "hangszerneve      "
  648. pn$(2) = "vol "
  649. pn$(3) = "sav0 "
  650. pn$(4) = "sav1 "
  651. pn$(5) = "sav2 "
  652. pn$(6) = "sav3 "
  653. pn$(7) = "sav4 "
  654. pn$(8) = "okt "
  655. FOR t = 0 TO 99: poli(t, 0) = 1: poli(t, 2) = 127: NEXT t
  656.  
  657.  
  658.  
  659. utosdec:
  660. un$(0) = "akt "
  661. un$(1) = "hangszerneve      "
  662. un$(2) = "vol "
  663. un$(3) = "sav "
  664.  
  665. FOR t = 0 TO 99: utos(t, 0) = 1: utos(t, 2) = 127: utos(t, 3) = t: NEXT t
  666.  
  667. utoshangszerrand:
  668. FOR t = 0 TO 99: utos(t, 3) = INT(x(24) * RND(1)): NEXT t
  669.  
  670. keszletdec:
  671. kn$(0) = "num "
  672. kn$(1) = "akt "
  673.  
  674. kn$(2) = "hang "
  675. kn$(3) = "okt "
  676.  
  677.  
  678. savdec:
  679. sn$(0) = "sav "
  680. sn$(1) = "elt "
  681. sn$(2) = "neg "
  682. sn$(3) = "muveleti eredmeny                  "
  683. sn$(4) = "jel "
  684. FOR t = 0 TO 99: sav(t, 0) = 0: NEXT t: RETURN
  685.  
  686. polimutat:
  687. ykpoli = 32
  688. LOCATE ykpoli - 1, xkpoli: COLOR _RGB32(255, 255, 255): PRINT "POLIFONIKUS HANGSZEREK"
  689. phol = 0: FOR t2 = 0 TO 9
  690.     IF LEN(pn$(t2)) THEN
  691.         COLOR _RGB32(177, 238, 127): LOCATE ykpoli, 1 + phol + xkpoli: PRINT pn$(t2)
  692.         FOR t = 0 TO x(30) - 1: ir$ = "--"
  693.  
  694.             SELECT CASE t2
  695.                 CASE 0: ir$ = bit$(poli(t, 0))
  696.                 CASE 1: ir$ = MID$(STR$(poli(t, 1)), 2) + "-" + midi$(poli(t, 1))
  697.                 CASE 2: ir$ = HEX$(poli(t, 2))
  698.                 CASE 3, 4, 5, 6, 7:
  699.                     IF (x(32) - (t2 - 3)) > 0 THEN ir$ = STR$(poli(t, t2))
  700.                 CASE 8: ir$ = STR$(poli(t, 8))
  701.             END SELECT
  702.  
  703.             xpoz = 1 + phol + xkpoli: ypoz = ykpoli + t + 1: xhossz = LEN(pn$(t2))
  704.             felt = (mauzy >= ypoz) AND (mauzy <= ypoz + yhossz)
  705.  
  706.             felt = (mauzx >= xpoz) AND (mauzx <= xpoz + xhossz) AND felt
  707.  
  708.             IF felt THEN COLOR aktiv1: aktiv$ = "poliparam": aktivp1 = t: aktivp2 = t2 ELSE COLOR aktiv2
  709.  
  710.             LOCATE ypoz, xpoz: ir$ = LEFT$(ir$, LEN(pn$(t2)))
  711.             IF polimutatakt(t) THEN COLOR aktiv1
  712.             PRINT ir$
  713.             IF felt THEN FOR t5 = 0 TO x(32) - 1: savmutatakt(poli(t, 3 + t5)) = 1: NEXT t5
  714.  
  715.  
  716.     NEXT t: END IF: phol = phol + LEN(pn$(t2))
  717. NEXT t2
  718. boxx1 = (xkpoli - 1) * 8
  719. boxy1 = (ykpoli - 2) * 16
  720. boxx2 = boxx1 + (phol + xhossz) * 8 - 6
  721. boxy2 = boxy1 + (x(30) + 2) * 16
  722.  
  723. COLOR keret: LINE (boxx1, boxy1)-(boxx2, boxy2), , B
  724.  
  725.  
  726. parammutat:
  727. xk = 114: yk = 3
  728. felt = mauzx >= (xk)
  729.  
  730. IF felt THEN aktiv$ = "parameterek": aktivp1 = INT(mauzy - 3)
  731.  
  732.  
  733. COLOR _RGB32(255, 255, 255)
  734. LOCATE 1, 114: PRINT "PARAMETEREK"
  735. FOR t = 0 TO 99
  736.     IF LEN(par$(t)) THEN
  737.         IF aktiv$ = "parameterek" AND aktivp1 = t THEN COLOR aktiv1 ELSE COLOR aktiv2
  738.         LOCATE yk + t, xk: PRINT par$(t)
  739.         LOCATE yk + t, xk + 15: PRINT x(par(t, 0))
  740.     END IF
  741. COLOR _RGB32(255, 255, 255)
  742. LOCATE 40, 114: PRINT "HELP - H-billenytu"
  743. LOCATE 42, 114: PRINT "ha elfogy a sav, nyomd meg a 0-at"
  744. LOCATE 43, 114: PRINT "hasznald az egeret, bal-jobb klikk"
  745. LOCATE 44, 114: PRINT "ertekek nov/csokk,es a gorgot"
  746.  
  747. LOCATE 55, 114: PRINT "Toth Gyula (30)4543730"
  748. LOCATE 56, 114: PRINT "facebook.com/gyula.toth.165"
  749.  
  750. utosmutat:
  751. LOCATE ykutos - 1, xkutos: COLOR _RGB32(255, 255, 255): PRINT "UTOS HANGSZEREK"
  752.  
  753. phol = 0: FOR t2 = 0 TO 9
  754.     IF LEN(un$(t2)) THEN
  755.         COLOR _RGB32(177, 238, 127): LOCATE ykutos, 1 + phol + xkutos: PRINT un$(t2)
  756.         FOR t = 0 TO x(31) - 1: ir$ = "--"
  757.  
  758.             SELECT CASE t2
  759.                 CASE 0: ir$ = bit$(utos(t, 0))
  760.                 CASE 1: ir$ = MID$(STR$(utos(t, 1)), 2) + "-" + midi$(utos(t, 1) + 128)
  761.                 CASE 2: ir$ = HEX$(utos(t, 2))
  762.                 CASE 3: ir$ = STR$(utos(t, 3))
  763.             END SELECT
  764.  
  765.             xpoz = 1 + phol + xkutos: ypoz = ykutos + t + 1: xhossz = LEN(un$(t2))
  766.  
  767.             felt = (mauzx >= xpoz) AND (mauzx <= xpoz + xhossz)
  768.             felt = (mauzy >= ypoz) AND (mauzy <= ypoz + yhossz) AND felt
  769.  
  770.  
  771.             IF felt THEN COLOR aktiv1: aktiv$ = "utosparam": aktivp1 = t: aktivp2 = t2 ELSE COLOR aktiv2
  772.             LOCATE ypoz, xpoz: ir$ = LEFT$(ir$, LEN(un$(t2)))
  773.             IF utosmutatakt(t) THEN COLOR aktiv1
  774.             PRINT ir$
  775.             IF felt THEN savmutatakt(utos(t, 3)) = 1
  776.     NEXT t: END IF: phol = phol + LEN(un$(t2))
  777. NEXT t2
  778.  
  779. boxx1 = (xkutos - 1) * 8
  780. boxy1 = (ykutos - 2) * 16
  781. boxx2 = boxx1 + (phol + xhossz) * 8 - 6
  782. boxy2 = boxy1 + (x(31) + 2) * 16
  783. COLOR keret: LINE (boxx1, boxy1)-(boxx2, boxy2), , B
  784.  
  785.  
  786.  
  787. savmutat:
  788. LOCATE yksav - 1, xksav: COLOR _RGB32(255, 255, 255): PRINT "GENERALT SAVOK ERTEKI"; x(1); ","; x(2); ","; x(22)
  789. phol = 0: FOR t2 = 0 TO 9
  790.     IF LEN(sn$(t2)) THEN
  791.         COLOR _RGB32(177, 238, 127): LOCATE yksav, 1 + phol + xksav: PRINT sn$(t2)
  792.         FOR t = 0 TO x(24) - 1: ir$ = "--"
  793.             aktualsav = aktivsav(t)
  794.             SELECT CASE t2
  795.                 CASE 0: ir$ = STR$(t)
  796.                 CASE 1: ir$ = STR$((sav(aktualsav, 1)))
  797.                 CASE 2: ir$ = (bit$(sav(aktualsav, 2)))
  798.                 CASE 3: ir$ = MID$(savok$(aktualsav), x(22) + sav(aktualsav, 1))
  799.                 CASE 4: ir$ = STR$(anali(aktualsav))
  800.             END SELECT
  801.  
  802.             xpoz = 1 + phol + xksav: ypoz = yksav + t + 1: xhossz = LEN(sn$(t2))
  803.  
  804.             felt = (mauzx >= xpoz) AND (mauzx <= xpoz + xhossz)
  805.             felt = (mauzy >= ypoz) AND (mauzy <= ypoz + yhossz) AND felt
  806.             IF felt AND ((t2 = 1 OR t2 = 2) OR t2 = 3) THEN COLOR aktiv1: aktiv$ = "savparam": aktivp1 = aktualsav: aktivp2 = t2 ELSE COLOR aktiv2
  807.             LOCATE ypoz, xpoz: ir$ = LEFT$(ir$, LEN(sn$(t2)))
  808.             IF savmutatakt(t) THEN COLOR aktiv1
  809.             PRINT ir$
  810.  
  811.             IF felt AND (t2 = 3) THEN
  812.                 FOR t5 = 0 TO 99
  813.                     IF utos(t5, 3) = t THEN utosmutatakt(t5) = 1
  814.                     FOR t6 = 0 TO x(32) - 1
  815.                         IF poli(t5, 3 + t6) = t THEN polimutatakt(t5) = 1
  816.                 NEXT t6, t5
  817.             END IF
  818.  
  819.         NEXT t
  820.     END IF
  821.  
  822.     phol = phol + LEN(sn$(t2))
  823. NEXT t2
  824.  
  825. boxx1 = (xksav - 1) * 8
  826. boxy1 = (yksav - 2) * 16
  827. boxx2 = boxx1 + (phol + xhossz) * 8 - 6
  828. boxy2 = boxy1 + (x(24) + 2) * 16
  829. COLOR keret: LINE (boxx1, boxy1)-(boxx2, boxy2), , B
  830.  
  831.  
  832.  
  833. keszletmutat:
  834. ykkeszlet = 32
  835. LOCATE ykkeszlet - 1, xkkeszlet: COLOR _RGB32(255, 255, 255): PRINT "AKTIVHANG"; x(33)
  836. phol = 0: FOR t2 = 0 TO 5
  837.     IF LEN(kn$(t2)) THEN
  838.         COLOR _RGB32(177, 238, 127): LOCATE ykkeszlet, 1 + phol + xkkeszlet: PRINT kn$(t2)
  839.         FOR t = 0 TO 2 ^ x(33) - 1: ir$ = "--"
  840.             SELECT CASE t2
  841.                 CASE 0: ir$ = STR$(t)
  842.                 CASE 1: ir$ = bit$(keszlet(t, 1))
  843.                 CASE 2: ir$ = STR$(keszlet(t, 2))
  844.                 CASE 3: ir$ = STR$(keszlet(t, 3))
  845.             END SELECT
  846.  
  847.             xpoz = 1 + phol + xkkeszlet: ypoz = ykkeszlet + t + 1: xhossz = LEN(kn$(t2))
  848.  
  849.             felt = (mauzx >= xpoz) AND (mauzx <= xpoz + xhossz)
  850.             felt = (mauzy >= ypoz) AND (mauzy <= ypoz + yhossz) AND felt
  851.             IF felt AND ((t2 = 1 OR t2 = 2) OR t2 = 3) THEN COLOR aktiv1: aktiv$ = "keszlet": aktivp1 = t: aktivp2 = t2 ELSE COLOR aktiv2
  852.             LOCATE ypoz, xpoz: ir$ = LEFT$(ir$, LEN(kn$(t2)))
  853.             PRINT ir$
  854.  
  855.  
  856.         NEXT t
  857.     END IF
  858.  
  859.     phol = phol + LEN(kn$(t2))
  860. NEXT t2
  861.  
  862. boxx1 = (xkkeszlet - 1) * 8
  863. boxy1 = (ykkeszlet - 2) * 16
  864. boxx2 = boxx1 + (phol + xhossz) * 8 - 6
  865. boxy2 = boxy1 + (x(32) + 2) * 16
  866. boxy2 = boxy1 + ((2 ^ x(32) + 2) * 16)
  867. COLOR keret: LINE (boxx1, boxy1)-(boxx2, boxy2), , B
  868.  
  869. FOR t = 0 TO 2 ^ x(33) - 1
  870.     IF keszlet(t, 1) THEN
  871.         boxx1 = (xkkeszlet + 16) * 8
  872.         boxy1 = (ykkeszlet + 3 - 2.5 + t) * 16
  873.         melyik = keszlet(t, 2)
  874.         boxx2 = xkhangk * 8
  875.         boxy2 = (ykhangk + 3 - 2.5 + melyik) * 16
  876.         REM        boxy2 = boxy1 + ((2 ^ x(32) + 2) * 16)
  877.         COLOR _RGB32(255, 255, 255): LINE (boxx1, boxy1)-(boxx2, boxy2)
  878.     END IF
  879.  
  880.  
  881.  
  882.  
  883. hangdec: ah = 0: okt = 0
  884. hk$ = "c-c#d-d#e-f-f#g-g#a-a#h-"
  885. FOR t = 0 TO 255
  886.     hangref$(t) = MID$(hk$, ah * 2 + 1, 2) + MID$(STR$(okt), 2)
  887.     ah = ah + 1: IF ah = 12 THEN ah = 0: okt = okt + 1
  888.  
  889. FOR t = 0 TO 11: hangnev$(t) = MID$(hk$, t * 2 + 1, 2): NEXT t
  890.  
  891.  
  892.  
  893.  
  894. hangokmutat:
  895. ykhangk = 32
  896. LOCATE ykhangk - 1, xkhangk: COLOR _RGB32(255, 255, 255): PRINT "HANGOK"
  897. phol = 0: FOR t2 = 0 TO 2
  898.     IF LEN(hn$(t2)) THEN
  899.         COLOR _RGB32(177, 238, 127): LOCATE ykhangk, 1 + phol + xkhangk: PRINT hn$(t2)
  900.         FOR t = 0 TO 11: ir$ = "--"
  901.             SELECT CASE t2
  902.                 CASE 0: ir$ = bit$(aktivkeszlet(t))
  903.                 CASE 1: ir$ = hangnev$(t)
  904.  
  905.             END SELECT
  906.  
  907.             xpoz = 1 + phol + xkhangk: ypoz = ykhangk + t + 1: xhossz = LEN(hn$(t2))
  908.  
  909.             felt = (mauzx >= xpoz) AND (mauzx <= xpoz + xhossz)
  910.             felt = (mauzy >= ypoz) AND (mauzy <= ypoz + yhossz) AND felt
  911.             IF felt AND ((t2 = 1 OR t2 = 2) OR t2 = 3) THEN COLOR aktiv1: aktiv$ = "aktivhangok": aktivp1 = t: aktivp2 = t2 ELSE COLOR aktiv2
  912.             LOCATE ypoz, xpoz: ir$ = LEFT$(ir$, LEN(hn$(t2)))
  913.             PRINT ir$
  914.  
  915.  
  916.         NEXT t
  917.  
  918.     END IF
  919.     phol = phol + LEN(hn$(t2))
  920. NEXT t2
  921.  
  922. boxx1 = (xkhangk - 1) * 8
  923. boxy1 = (ykhangk - 2) * 16
  924. boxx2 = boxx1 + (phol + xhossz) * 8 - 6
  925. boxy2 = boxy1 + 14 * 16
  926. COLOR keret: LINE (boxx1, boxy1)-(boxx2, boxy2), , B
  927.  
  928. randhangsor5:
  929. aktivkeszlet(0) = 1
  930. aktivkeszlet(1) = 0
  931. aktivkeszlet(2) = 1
  932. aktivkeszlet(3) = 0
  933. aktivkeszlet(4) = 1
  934. aktivkeszlet(5) = 0
  935. aktivkeszlet(6) = 0
  936. aktivkeszlet(7) = 1
  937. aktivkeszlet(8) = 0
  938. aktivkeszlet(9) = 1
  939. aktivkeszlet(10) = 0
  940. aktivkeszlet(11) = 0
  941. randhangsor7:
  942. aktivkeszlet(0) = 1
  943. aktivkeszlet(1) = 0
  944. aktivkeszlet(2) = 1
  945. aktivkeszlet(3) = 0
  946. aktivkeszlet(4) = 1
  947. aktivkeszlet(5) = 1
  948. aktivkeszlet(6) = 0
  949. aktivkeszlet(7) = 1
  950. aktivkeszlet(8) = 0
  951. aktivkeszlet(9) = 1
  952. aktivkeszlet(10) = 0
  953. aktivkeszlet(11) = 1
  954.  
  955.  
  956. randoktkeszlet:
  957. FOR t = 0 TO 2 ^ x(33) - 1
  958.     keszlet(t, 3) = INT(2 * RND(1)) - 1
  959.  
  960.  
  961.  
  962. randaktivhangdec:
  963. FOR t = 0 TO 2 ^ x(33) - 1
  964.     keszlet(t, 1) = INT(2 * RND(1))
  965.  
  966. keszletminta4bit:
  967. minta = INT(8 * RND(1)): hh = 0
  968.  
  969. FOR t = 0 TO 2 ^ x(33) - 1
  970.     keszlet(t, 1) = SGN(minta AND 2 ^ hh)
  971.     hh = hh + 1: hh = hh AND 3
  972.  
  973.  
  974.  
  975. randrendeles:
  976. FOR t = 0 TO 2 ^ x(33) - 1
  977.  
  978.     112: melyik = INT(12 * RND(1))
  979.     IF aktivkeszlet(melyik) = 0 THEN GOTO 112
  980.     keszlet(t, 2) = melyik
  981.  
  982. sorrendrendeles: melyik = 0
  983. FOR t = 0 TO 2 ^ x(33) - 1
  984.     IF keszlet(t, 1) THEN
  985.        114: melyik = melyik + 1: IF melyik = 12 THEN melyik = 0
  986.         IF aktivkeszlet(melyik) = 0 THEN GOTO 114
  987.         keszlet(t, 2) = melyik
  988.     END IF
  989.  
  990. randaktivkeszlet: FOR t = 0 TO 11:
  991.     aktivkeszlet(t) = INT(2 * RND(1))
  992.  
  993.  
  994. midihangszer: FOR t = 0 TO x(30) - 1: mh = t: IF t > 8 THEN mh = mh + 1
  995.     kom = 12 + mh + poli(t, 1) * 256: q = midiOutShortMsg(hmidiout, kuld)
  996.  
  997. midipolion:
  998.  
  999. FOR t = 0 TO 22: mh = t: IF t > 8 THEN mh = mh + 1
  1000.  
  1001.  
  1002.     REM     eltolas = sav(aktualsav, 1)
  1003.  
  1004.  
  1005.     hangero = poli(t, 2)
  1006.     h1 = SGN(MID$(savok$(aktivsav(poli(t, 3))), x(22) + 1 + eltolas, 1) = bit$(1))
  1007.     h2 = SGN(MID$(savok$(aktivsav(poli(t, 4))), x(22) + 1 + eltolas, 1) = bit$(1))
  1008.     h3 = SGN(MID$(savok$(aktivsav(poli(t, 5))), x(22) + 1 + eltolas, 1) = bit$(1))
  1009.     h4 = SGN(MID$(savok$(aktivsav(poli(t, 6))), x(22) + 1 + eltolas, 1) = bit$(1))
  1010.     h5 = SGN(MID$(savok$(aktivsav(poli(t, 7))), x(22) + 1 + eltolas, 1) = bit$(1))
  1011.  
  1012.  
  1013.  
  1014.     aktive1 = poli(t, 0)
  1015.     okt1 = poli(t, 8)
  1016.  
  1017.     egyuttallas = (h1 + h2 * 2 + h3 * 4 + h4 * 8 + h5 * 16)
  1018.     egyuttallas = egyuttallas AND (2 ^ x(32) - 1)
  1019.  
  1020.     melyikhang = keszlet(egyuttallas, 2)
  1021.     aktive2 = keszlet(egyuttallas, 1)
  1022.  
  1023.     okt2 = keszlet(egyuttallas, 3)
  1024.     aktive3 = aktivkeszlet(melyikhang)
  1025.     ahangszer = poli(t, 1)
  1026.  
  1027.  
  1028.  
  1029.  
  1030.     REM hangszer kuldes
  1031.  
  1032.     REM uj hang kuldes, es eltarolni
  1033.     hang = (35 + melyikhang + (okt1 + okt2 + 2) * 12)
  1034.     csatorna = mh
  1035.     hangero = 127 * SGN(aktive1 AND (aktive2 AND aktive3))
  1036.     hangszer = ahangszer
  1037.  
  1038.     REM kussoltatas ha :hang vagy hangszer valtozik vagy direktvalzotatas van
  1039.     feltetel1 = utolsohangszer(csatorna) <> ahangszer
  1040.     feltetel2 = utolsohang(csatorna) <> hang
  1041.     feltetel3 = x(39) OR (t > x(30) - 1)
  1042.     IF (feltetel1 OR feltetel2) OR feltetel3 THEN
  1043.         REM kussoltatas
  1044.         kuld = csatorna + 9 * 16 + utolsohang(csatorna) * 256 + 0 * 65536: q = midiOutShortMsg(hmidiout, kuld)
  1045.     END IF
  1046.  
  1047.     IF feltetel1 THEN
  1048.         REM hangszer beallitasa
  1049.         kuld = csatorna + 12 * 16 + ahangszer * 256 + 127 * 65536: q = midiOutShortMsg(hmidiout, kuld)
  1050.     END IF
  1051.  
  1052.     IF (feltetel2 OR feltetel3) AND (t < x(30)) THEN
  1053.         REM csatornara hang kiadasa es rogzitese
  1054.         kuld = csatorna + 9 * 16 + hang * 256 + hangero * 65536: q = midiOutShortMsg(hmidiout, kuld)
  1055.     END IF
  1056.     utolsohang(csatorna) = hang
  1057.     utolsohangszer(csatorna) = ahangszer
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065. csend: RETURN
  1066. FOR t = 0 TO x(30) - 1: mh = t: IF t > 8 THEN mh = mh + 1
  1067.     kuld = csend(t)
  1068.     q = midiOutShortMsg(hmidiout, kuld)
  1069.  
  1070. feltcsend: RETURN
  1071. FOR t = 0 TO x(30) - 1: mh = t: IF t > 8 THEN mh = mh + 1
  1072.     IF marad(t) = 0 THEN
  1073.         kuld = csend(t)
  1074.         q = midiOutShortMsg(hmidiout, kuld)
  1075.     END IF
  1076.  
  1077. decparam:
  1078. q = 0: par(q, 0) = 34: par(q, 1) = -21: par(q, 2) = 21: par$(q) = "leptek-szorzo"
  1079. q = 1: par(q, 0) = 30: par(q, 1) = 0: par(q, 2) = 20: par$(q) = "polihangszer"
  1080. q = 2: par(q, 0) = 31: par(q, 1) = 0: par(q, 2) = 20: par$(q) = "utoshangszer"
  1081. q = 3: par(q, 0) = 24: par(q, 1) = 2: par(q, 2) = 25: par$(q) = "savok szama"
  1082. q = 4: par(q, 0) = 35: par(q, 1) = 10: par(q, 2) = 100: par$(q) = "tempo"
  1083. q = 5: par(q, 0) = 23: par(q, 1) = 0: par(q, 2) = 3: par$(q) = "metronom"
  1084. q = 6: par(q, 0) = 32: par(q, 1) = 0: par(q, 2) = 5: par$(q) = "hangkeszlet"
  1085.  
  1086. q = 7: par(q, 0) = 36: par(q, 1) = 1: par(q, 2) = 500: par$(q) = "sorozat TAG1"
  1087. q = 8: par(q, 0) = 37: par(q, 1) = 1: par(q, 2) = 500: par$(q) = "sorozat TAG2"
  1088. q = 9: par(q, 0) = 38: par(q, 1) = 1: par(q, 2) = 10000: par$(q) = "sorozat szorzo"
  1089. q = 10: par(q, 0) = 39: par(q, 1) = 0: par(q, 2) = 1: par$(q) = "poli-hangszer lecsengese"
  1090.  
  1091.  
  1092. zenementese2:
  1093. Filter$ = "Zenei-Algoritmus files (*.alg)|*.ALG|All files (*.*)|*.*"
  1094. Flags& = OFN_OVERWRITEPROMPT + OFN_NOCHANGEDIR '   add flag constants here
  1095. SFile$ = GetSaveFileName$("Zenei Algoritmus mentese                                                                     ", ".\", Filter$, 1, Flags&, hWnd&)
  1096.  
  1097. fajlnev$ = "last.alg": GOSUB zenementese
  1098. IF SFile$ <> "" THEN fajlnev$ = SFile$: GOSUB zenementese
  1099.  
  1100.  
  1101. zenementese:
  1102.  
  1103. OPEN fajlnev$ FOR OUTPUT AS 1
  1104. PRINT #1, sv$
  1105. PRINT #1, aleptek
  1106. FOR t1 = 0 TO 99: FOR t2 = 0 TO 19: PRINT #1, utos(t1, t2): NEXT t2, t1
  1107. FOR t1 = 0 TO 99: FOR t2 = 0 TO 19: PRINT #1, poli(t1, t2): NEXT t2, t1
  1108. FOR t1 = 0 TO 99: FOR t2 = 0 TO 19: PRINT #1, sav(t1, t2): NEXT t2, t1
  1109. FOR t1 = 0 TO 99: PRINT #1, savok$(t1): NEXT t1
  1110. FOR t1 = 0 TO 9999: PRINT #1, x(t1): NEXT t1
  1111. FOR t1 = 0 TO 99: PRINT #1, aktivsav(t1): NEXT t1
  1112. FOR t1 = 0 TO 99: PRINT #1, savmutatakt(t1): NEXT t1
  1113. FOR t1 = 0 TO 99: PRINT #1, polimutatakt(t1): NEXT t1
  1114. FOR t1 = 0 TO 99: PRINT #1, utosmutatakt(t1): NEXT t1
  1115. FOR t1 = 0 TO 99: FOR t2 = 0 TO 3: PRINT #1, keszlet(t1, t2): NEXT t2, t1
  1116. FOR t1 = 0 TO 11: PRINT #1, aktivkeszlet(t1): NEXT t1
  1117.  
  1118. zenebetoltese:
  1119. IF fajlnev$ <> "last.alg" THEN
  1120.     Filter$ = "Zenei-Algoritmus files (*.alg)|*.ALG|All files (*.*)|*.*"
  1121.     Flags& = OFN_FILEMUSTEXIST + OFN_NOCHANGEDIR + OFN_READONLY '    add flag constants here
  1122.     OFile$ = GetOpenFileName$("Zenei Algoritmus betoltese                                                                                            ", ".\", Filter$, 1, Flags&, hWnd&)
  1123.  
  1124.     fajlnev$ = OFile$
  1125.  
  1126. IF _FILEEXISTS(fajlnev$) = 0 THEN RETURN
  1127.  
  1128. OPEN fajlnev$ FOR INPUT AS 1
  1129. LINE INPUT #1, ver$: IF ver$ <> sv$ THEN GOTO 888
  1130. INPUT #1, aleptek
  1131. FOR t1 = 0 TO 99: FOR t2 = 0 TO 19: INPUT #1, utos(t1, t2): NEXT t2, t1
  1132. FOR t1 = 0 TO 99: FOR t2 = 0 TO 19: INPUT #1, poli(t1, t2): NEXT t2, t1
  1133. FOR t1 = 0 TO 99: FOR t2 = 0 TO 19: INPUT #1, sav(t1, t2): NEXT t2, t1
  1134. FOR t1 = 0 TO 99: INPUT #1, savok$(t1): NEXT t1
  1135. FOR t1 = 0 TO 9999: INPUT #1, x(t1): NEXT t1
  1136. FOR t1 = 0 TO 99: INPUT #1, aktivsav(t1): NEXT t1
  1137. FOR t1 = 0 TO 99: INPUT #1, savmutatakt(t1): NEXT t1
  1138. FOR t1 = 0 TO 99: INPUT #1, polimutatakt(t1): NEXT t1
  1139. FOR t1 = 0 TO 99: INPUT #1, utosmutatakt(t1): NEXT t1
  1140. FOR t1 = 0 TO 99: FOR t2 = 0 TO 3: INPUT #1, keszlet(t1, t2): NEXT t2, t1
  1141. FOR t1 = 0 TO 11: INPUT #1, aktivkeszlet(t1): NEXT t1
  1142. 888: CLOSE 1: RETURN
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150. szisz:
  1151.  
  1152.  
  1153.  
  1154.  
  1155. FUNCTION GetOpenFileName$ (Title$, InitialDir$, Filter$, FilterIndex, Flags&, hWnd&)
  1156.     '  Title$      - The dialog title.
  1157.     '  InitialDir$ - If this left blank, it will use the directory where the last opened file is
  1158.     '  located. Specify ".\" if you want to always use the current directory.
  1159.     '  Filter$     - File filters separated by pipes (|) in the same format as using VB6 common dialogs.
  1160.     '  FilterIndex - The initial file filter to use. Will be altered by user during the call.
  1161.     '  Flags&      - Dialog flags. Will be altered by the user during the call.
  1162.     '  hWnd&       - Your program's window handle that should be aquired by the FindWindow function.
  1163.     '
  1164.     ' Returns: Blank when cancel is clicked otherwise, the file name selected by the user.
  1165.     ' FilterIndex and Flags& will be changed depending on the user's selections.
  1166.  
  1167.     DIM OpenCall AS FILEDIALOGTYPE ' Needed for dialog call
  1168.  
  1169.     fFilter$ = Filter$
  1170.     FOR R = 1 TO LEN(fFilter$) ' Replace the pipes with character zero
  1171.         IF MID$(fFilter$, R, 1) = "|" THEN MID$(fFilter$, R, 1) = CHR$(0)
  1172.     NEXT R
  1173.     fFilter$ = fFilter$ + CHR$(0)
  1174.  
  1175.     lpstrFile$ = STRING$(2048, 0) ' For the returned file name
  1176.     lpstrDefExt$ = STRING$(10, 0) ' Extension will not be added when this is not specified
  1177.     OpenCall.lStructSize = LEN(OpenCall)
  1178.     OpenCall.hwndOwner = hWnd&
  1179.     OpenCall.lpstrFilter = _OFFSET(fFilter$)
  1180.     OpenCall.nFilterIndex = FilterIndex
  1181.     OpenCall.lpstrFile = _OFFSET(lpstrFile$)
  1182.     OpenCall.nMaxFile = LEN(lpstrFile$) - 1
  1183.     OpenCall.lpstrFileTitle = OpenCall.lpstrFile
  1184.     OpenCall.nMaxFileTitle = OpenCall.nMaxFile
  1185.     OpenCall.lpstrInitialDir = _OFFSET(InitialDir$)
  1186.     OpenCall.lpstrTitle = _OFFSET(Title$)
  1187.     OpenCall.lpstrDefExt = _OFFSET(lpstrDefExt$)
  1188.     OpenCall.flags = Flags&
  1189.  
  1190.     Result = GetOpenFileNameA&(OpenCall) '            Do Open File dialog call!
  1191.  
  1192.     IF Result THEN ' Trim the remaining zeros
  1193.         GetOpenFileName$ = LEFT$(lpstrFile$, INSTR(lpstrFile$, CHR$(0)) - 1)
  1194.         Flags& = OpenCall.flags
  1195.         FilterIndex = OpenCall.nFilterIndex
  1196.     END IF
  1197.  
  1198.  
  1199. FUNCTION GetSaveFileName$ (Title$, InitialDir$, Filter$, FilterIndex, Flags&, hWnd&)
  1200.     '  Title$      - The dialog title.
  1201.     '  InitialDir$ - If this left blank, it will use the directory where the last opened file is
  1202.     '     located. Specify ".\" if you want to always use the current directory.
  1203.     '  Filter$     - File filters separated by pipes (|) in the same format as VB6 common dialogs.
  1204.     '  FilterIndex - The initial file filter to use. Will be altered by user during the call.
  1205.     '  Flags&      - Dialog flags. Will be altered by the user during the call.
  1206.     '  hWnd&       - Your program's window handle that should be aquired by the FindWindow function.
  1207.  
  1208.     ' Returns: Blank when cancel is clicked otherwise, the file name entered by the user.
  1209.     ' FilterIndex and Flags& will be changed depending on the user's selections.
  1210.  
  1211.     DIM SaveCall AS FILEDIALOGTYPE ' Needed for dialog call
  1212.  
  1213.     fFilter$ = Filter$
  1214.     FOR R = 1 TO LEN(fFilter$) ' Replace the pipes with zeros
  1215.         IF MID$(fFilter$, R, 1) = "|" THEN MID$(fFilter$, R, 1) = CHR$(0)
  1216.     NEXT R
  1217.     fFilter$ = fFilter$ + CHR$(0)
  1218.  
  1219.     lpstrFile$ = STRING$(2048, 0) ' For the returned file name
  1220.     lpstrDefExt$ = STRING$(10, 0) ' Extension will not be added when this is not specified
  1221.     SaveCall.lStructSize = LEN(SaveCall)
  1222.     SaveCall.hwndOwner = hWnd&
  1223.     SaveCall.lpstrFilter = _OFFSET(fFilter$)
  1224.     SaveCall.nFilterIndex = FilterIndex
  1225.     SaveCall.lpstrFile = _OFFSET(lpstrFile$)
  1226.     SaveCall.nMaxFile = LEN(lpstrFile$) - 1
  1227.     SaveCall.lpstrFileTitle = SaveCall.lpstrFile
  1228.     SaveCall.nMaxFileTitle = SaveCall.nMaxFile
  1229.     SaveCall.lpstrInitialDir = _OFFSET(InitialDir$)
  1230.     SaveCall.lpstrTitle = _OFFSET(Title$)
  1231.     SaveCall.lpstrDefExt = _OFFSET(lpstrDefExt$)
  1232.     SaveCall.flags = Flags&
  1233.  
  1234.     Result& = GetSaveFileNameA&(SaveCall) ' Do dialog call!
  1235.  
  1236.     IF Result& THEN ' Trim the remaining zeros
  1237.         GetSaveFileName$ = LEFT$(lpstrFile$, INSTR(lpstrFile$, CHR$(0)) - 1)
  1238.         Flags& = SaveCall.flags
  1239.         FilterIndex = SaveCall.nFilterIndex
  1240.     END IF
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.