home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / TUT15.ZIP / TUT15.TXT < prev    next >
Text File  |  1994-09-16  |  8KB  |  187 lines

  1.                    ╒═══════════════════════════════╕
  2.                    │         W E L C O M E         │
  3.                    │  To the VGA Trainer Program   │ │
  4.                    │              By               │ │
  5.                    │      DENTHOR of ASPHYXIA      │ │ │
  6.                    ╘═══════════════════════════════╛ │ │
  7.                      ────────────────────────────────┘ │
  8.                        ────────────────────────────────┘
  9.  
  10.                            --==[ PART 15 ]==--
  11.  
  12.  
  13.  
  14. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15. ■ Introduction
  16.  
  17. Hello again. As you can see, this tut is very soon after the last one.
  18. This is because of two reasons ... 1) The PCGPE ][ will be out soon, so
  19. I thought I would make sure I have more then just four new trainers for it,
  20. and 2) I am usually so late between tuts, I thought I would make up for it.
  21.  
  22. There is a discussion going on in Usenet, mostly saying that trainers etc.
  23. should be written a bit more formally and none of this gay banter and
  24. familiar language should be used. My "quotes" would definately be out ;-)
  25. But, until I get paid for doing this (and there don't seem to be any takers
  26. on that score), I will continue to write in this manner. My apologies to those
  27. who dont like this, but hey, its free, what did you expect?
  28.  
  29. This trainer is on plasmas, and the sample program actually became quite large,
  30. mostly due to the fact that there was some plasma stuff I wanted to try out.
  31.  
  32. The concept is very simple, at least for this plasma, so you shouldn't have
  33. any problems understanding it ... AFTER you have read the text file ...
  34. jumping straight into the source may be hazardous to your brain.
  35.  
  36. Plasmas are a great way to wow your friends by their wierd shapes and forms.
  37. I was at one stage going to write a game where the bad guy just had two
  38. circular plasmas instead of eyes... I am sure you will find creative and
  39. inventive new ways of doing and using plasmas.
  40.  
  41.  
  42. If you would like to contact me, or the team, there are many ways you
  43. can do it : 1) Write a message to Grant Smith/Denthor/Asphyxia in private mail
  44.                   on the ASPHYXIA BBS.
  45.             2) Write to :  Grant Smith
  46.                            P.O.Box 270 Kloof
  47.                            3640
  48.                            Natal
  49.                            South Africa
  50.             3) Call me (Grant Smith) at (031) 73 2129 (leave a message if you
  51.                   call during varsity). Call +27-31-73-2129 if you call
  52.                   from outside South Africa. (It's YOUR phone bill ;-))
  53.             4) Write to denthor@beastie.cs.und.ac.za in E-Mail.
  54.             5) Write to asphyxia@beastie.cs.und.ac.za to get to all of
  55.                us at once.
  56.  
  57. NB : If you are a representative of a company or BBS, and want ASPHYXIA
  58.        to do you a demo, leave mail to me; we can discuss it.
  59. NNB : If you have done/attempted a demo, SEND IT TO ME! We are feeling
  60.         quite lonely and want to meet/help out/exchange code with other demo
  61.         groups. What do you have to lose? Leave a message here and we can work
  62.         out how to transfer it. We really want to hear from you!
  63.  
  64.  
  65.  
  66. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  67. ■  How do plasmas work?
  68.  
  69. I will only cover one type of plasma here ... a realtime plasma of course.
  70. Other types of plasmas include a static picture with a pallette rotation...
  71.  
  72. When you get right down to it, this method of realtime plasmas is merely an
  73. intersection of four COS waves. We get our color at a particular point by
  74. saying :
  75.       col := costbl[one]+costbl[two]+costbl[three]+costbl[four];
  76.  
  77. The trick is getting the four indexes of that cos table array to create
  78. something that looks nice. This is how we organise it : Have two of them
  79. being indexes for vertical movement and two of them being indexes for
  80. horizontal movement.
  81.  
  82. This means that by changing these values we can move along the plasma. To
  83. draw an individual screen, we pass the values of the four to another four
  84. so that we do not disturb the origional values. For every pixel across, we
  85. add values to the first two indexes, then display the next pixel. For
  86. every row down, we add values to the second two indexes. Sound complex
  87. enough? Good, because that what we want, a complex shape on the screen.
  88.  
  89. By altering the origional four values, we can get all sorts of cool movement
  90. and cycling of the plasma. The reason we use a cos table is as follows :
  91. a cos table has a nice curve in the value of the numbers ... when you
  92. put two or more together, it is possible to get circular pictures ...
  93. circles are hard to do on a computer, so this makes it a lot easier...
  94.  
  95. Okay, now you can have a look at the source file, all I do is put the above
  96. into practice. I did add one or two things though ...
  97.  
  98. Background : This is just a large array, with the values in the array being
  99. added to the plasma at that pixel.
  100.  
  101. Psychadelic : This cycles through about 7000 colors instead of just rotating
  102. through the base 256.
  103.  
  104.  
  105. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  106. ■  Clever fading
  107.  
  108. You will notice when the sample program fades in and out that the colors
  109. all reach their destination at the same time ... it other words, they don't
  110. all increment by one until they hit the right color then stop. When done
  111. in that way the fading does not look as professional.
  112.  
  113. Here is how we do a step-crossfade.
  114.  
  115. Each r,g,b value can be between 0 and 64. Have the pallette we want to get
  116. to in bob and the temporary pallette in bob2. For each step, from 0 to 63
  117. do the following :
  118.      bob2[loop1].r:=bob[loop1].r*step/64;
  119.  
  120. That means if we are halfway through the crossfade (step=32) and the red
  121. value is meant to get to 16, our equation looks like this :
  122.     r:=16*32/64
  123.      r=8
  124.  
  125. Which is half of the way to where it wants to be. This means all colors will
  126. fade in/out with the same ratios... and look nicer.
  127.  
  128.  
  129. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  130. ■  Rotating the pallette
  131.  
  132. I have done this one before I think .. here it is ...
  133.  
  134. move color 0 into temp
  135.  
  136. move color 1 into color 0
  137. move color 2 into color 1
  138. move color 3 into color 2
  139. and so on till color 255
  140.  
  141. move temp into color 255
  142.  
  143. And you pallette is rotating. Easy huh? Recheck tut 2 for more info on
  144. pallette rotation
  145.  
  146. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  147. ■  In closing
  148.  
  149. The text file was a bit short this time, but that is mostly because the
  150. sample file is self explanitory. The file can however be speeded up, and
  151. of course you can add certain things which will totally change the look
  152. of the plasma.
  153.  
  154. As always, I am on the lookout for more ideas for future tuts, if you have
  155. some, mail me!
  156.  
  157. No quote today, this lan doesn't encourage creative thinking ;) However,
  158. there will be quotes in future as I have been told that some people like
  159. them. Even Pipsy said this while we were playing Ctrl-Alt-Del (two player
  160. game, one has to hit ctrl and alt as the other hits del, and the person
  161. hitting the del has to do it quickly so that the computer doesnt reboot.
  162. If the computer reboots the person who was hitting ctrl and alt has won.
  163. I thought I was doing really badly against Pipsy until I found out that the
  164. computer had frozen ;-))
  165.  
  166. Byeeee....
  167.   - Denthor
  168.       14:11
  169.         16-9-94
  170.  
  171.  
  172. The following are official ASPHYXIA distribution sites :
  173.  
  174. ╔══════════════════════════╦════════════════╦═════╗
  175. ║BBS Name                  ║Telephone No.   ║Open ║
  176. ╠══════════════════════════╬════════════════╬═════╣
  177. ║ASPHYXIA BBS #1           ║+27-31-765-5312 ║ALL  ║
  178. ║ASPHYXIA BBS #2           ║+27-31-765-6293 ║ALL  ║
  179. ║C-Spam BBS                ║410-531-5886    ║ALL  ║
  180. ║POP!                      ║+27-12-661-1257 ║ALL  ║
  181. ║Soul Asylum               ║+358-0-5055041  ║ALL  ║
  182. ║Wasted Image              ║407-838-4525    ║ALL  ║
  183. ╚══════════════════════════╩════════════════╩═════╝
  184.  
  185. Leave me mail if you want to become an official Asphyxia BBS
  186. distribution site.
  187.