Ci-dessous, les différences entre deux révisions de la page.
Révision précédente | |||
— | back2root:archives:denthor:part-17 [2025/07/07 16:24] (Version actuelle) – [In closing] frater | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ===== PART 17 : Pixel Morphing ===== | ||
+ | Hi there everybody. It's a new year, but the parties are over and it's time to get coding again! | ||
+ | |||
+ | My mailserver died. Various sysadmins decided it was time to upgrade the OS, and wound up nuking the hard drive :-( ... this means that request-list is not working at the moment, and I have probably lost lots of mail. | ||
+ | |||
+ | denthor@beastie.cs.und.ac.za is still the account to write to, and hopefully the mailserver will be back up in the near future. | ||
+ | |||
+ | There are various C/C++ conversions of my trainer, best of which seem to be those by Snowman ... he runs through the text files with C++ updates (and seems to point out my previous mistakes with glee ;-), as well is giving a | ||
+ | fully documented C++ conversion of the source ... very nice stuff. | ||
+ | |||
+ | Also, my trainers are being put on a World Wide Web site ... it is still under construction, | ||
+ | awful, anyone want to write a nice one for me? ;) | ||
+ | |||
+ | I have just about finished Asphyxia' | ||
+ | |||
+ | Tut 16 dies with large bitmaps ... the way to sort this out is to decrease the accuracy of the fixed point from 256 to 128 ... then you can have bitmaps up to 512 pixels wide. I will be putting an updated scale routine | ||
+ | in the gfx4.pas unit. | ||
+ | |||
+ | This tutor is on a few demo effects (pixel morphs and static) ... after this one, I will go on to more theory ... perhaps some more 3d stuff, such as gourad shading etc. Comments? | ||
+ | |||
+ | |||
+ | If you would like to contact me, or the team, there are many ways you can do it : | ||
+ | < | ||
+ | 1) Write a message to Grant Smith/ | ||
+ | 2) Write to : Grant Smith | ||
+ | | ||
+ | 3640 | ||
+ | Natal | ||
+ | South Africa | ||
+ | 3) Call me (Grant Smith) at (031) 73 2129 (leave a message if you call during varsity). Call +27-31-73-2129 if you call from outside South Africa. (It's YOUR phone bill ;-)) | ||
+ | 4) Write to denthor@beastie.cs.und.ac.za in E-Mail. | ||
+ | 5) Write to asphyxia@beastie.cs.und.ac.za to get to all of us at once. | ||
+ | </ | ||
+ | |||
+ | NB : If you are a representative of a company or BBS, and want ASPHYXIA to do you a demo, leave mail to me; we can discuss it. | ||
+ | |||
+ | NNB : If you have done/ | ||
+ | |||
+ | ==== Pixel Morphing ==== | ||
+ | |||
+ | Have you ever lain down on your back in the grass and looked up at the cloudy sky? If you have, you have probably seen the clouds move together and create wonderful shapes ... that cloud plus that cloud together make a | ||
+ | whale ... a ship ... a face etc. | ||
+ | |||
+ | We can't quite outdo mother nature, but we can sure give it a shot. The effect I am going to show you is where various pixels at different starting points move together and create an overall picture. | ||
+ | |||
+ | The theory behind it is simple : Each pixel has bits of data associated with it, most important of which is as follows : | ||
+ | |||
+ | < | ||
+ | This is my color | ||
+ | This is where I am | ||
+ | This is where I want to be. | ||
+ | </ | ||
+ | |||
+ | The pixel, keeping it's color, goes from where it is to where it wants to be. Our main problem is _how_ it moves from where it is to where it wants to be. A obvious approach would be to say "If it's destination is above it, | ||
+ | decrement it's y value, if the destination is to the left, decrement it's x value and so on." | ||
+ | |||
+ | This would be bad. The pixel would only ever move at set angles, as you can see below : | ||
+ | |||
+ | < | ||
+ | Dest | ||
+ | | ||
+ | \ | ||
+ | \ | ||
+ | O Source | ||
+ | </ | ||
+ | |||
+ | Doesn' | ||
+ | |||
+ | < | ||
+ | Dest 1 | ||
+ | Dest 2 | ||
+ | </ | ||
+ | |||
+ | Pixels 1 and 2 must get to their destinations at the same time for the best effect. The way this is done by defining the number of frames or " | ||
+ | |||
+ | The next question, it how do we move the pixels in a straight line? This is easier then you think... | ||
+ | |||
+ | Let us assume that for each pixel, x1,y1 is where it is, and x2,y2 is where it wants to be. | ||
+ | |||
+ | < | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | If we do the following : | ||
+ | |||
+ | <code pascal> | ||
+ | dx := (x2-x1)/64; | ||
+ | </ | ||
+ | |||
+ | we come out with a value in dx wich is very useful. If we added dx to x1 64 times, the result would be x2! Let us check... | ||
+ | |||
+ | <code pascal> | ||
+ | dx = (x2-x1)/64 | ||
+ | dx*64 = x2-x1 { Multiply both sides by 64 } | ||
+ | dx*64+x1 = x2 { Add x1 to both sides } | ||
+ | </ | ||
+ | |||
+ | This is high school math stuff, and is pretty self explanitory. So what we have is the x movement for every frame that the pixel has to undergo. We find the y movement in the same manner. | ||
+ | |||
+ | <code pascal> | ||
+ | dy := (y2-y1)/64; | ||
+ | </ | ||
+ | |||
+ | So our program is as follows : | ||
+ | |||
+ | <code pascal> | ||
+ | Set x1,y1 and x2,y2 values | ||
+ | dx:= (x2-x1)/64; | ||
+ | dy:= (y2-y1)/64; | ||
+ | |||
+ | for loop1:=1 to 64 do BEGIN | ||
+ | putpixel (x1,y1) | ||
+ | wait; | ||
+ | clear pixel (x1,y1); | ||
+ | x1:=x1+dx; | ||
+ | y1:=y1+dy; | ||
+ | END; | ||
+ | </ | ||
+ | |||
+ | If there was a compiler that could use the above pseudocode, it would move the pixel from x1,y1 to x2,y2 in 64 steps. | ||
+ | |||
+ | So, what we do is set up an array of many pixels with this information, | ||
+ | |||
+ | Why not use pixel morphing on a base object in 3d? It would be the work of a moment to add in a Z axis to the above. | ||
+ | |||
+ | The sample program uses fixed point math in order to achieve high speeds, but it is basically the above algorithm. | ||
+ | |||
+ | ==== Static ==== | ||
+ | |||
+ | A static screen was one of the first effects Asphyxia ever did. We never actually released it because we couldn' | ||
+ | |||
+ | The easiest way to get a sreen of static is to tune your TV into an unused station ... you even get the cool noise effect too. Those people who build TV's really know how to code ;-) | ||
+ | |||
+ | For us on a PC however, it is not as easy to generate a screen full of static (unless you desperately need a new monitor) | ||
+ | |||
+ | What we do is this : | ||
+ | |||
+ | < | ||
+ | Set colors 1-16 to various shades of grey. | ||
+ | Fill the screen up with random pixels between colors 1 and 16 | ||
+ | Rotate the pallette of colors 1 to 16. | ||
+ | </ | ||
+ | |||
+ | That's it! You have a screenfull of static! To get two images in one static screen, all you need to do is fade up/down the specific colors you are using for static in one of the images. | ||
+ | |||
+ | A nice thing about a static screen is that it is just pallette rotations... you can do lots of things in the foreground at the same time (such as ascroller). | ||
+ | |||
+ | ==== Code Source ==== | ||
+ | |||
+ | <code pascal> | ||
+ | {$X+} | ||
+ | USES crt,gfx3; | ||
+ | |||
+ | Const jump = 64; { Number of pixels active at once } | ||
+ | sjump = 6; { 1 shl 6 = 64 } | ||
+ | |||
+ | TYPE | ||
+ | FontDat = Array [' ' | ||
+ | target = record | ||
+ | | ||
+ | | ||
+ | dy,dx : integer; | ||
+ | | ||
+ | col : byte; | ||
+ | | ||
+ | END; | ||
+ | PixelDat = Array [1..4095] of target; { This is the maximum number | ||
+ | of points we canb fit in a | ||
+ | segment... } | ||
+ | |||
+ | VAR Font : ^FontDat; | ||
+ | nextrow : ^PixelDat; | ||
+ | scr : array [' ' | ||
+ | Vir2 : VirtPtr; | ||
+ | Vaddr2 : Word; { Spare virtual screen } | ||
+ | counter: | ||
+ | PosLoop: | ||
+ | dir : boolean; | ||
+ | pathx, | ||
+ | arbpal : array [1..8,1..3] of byte; { Used to remember certain | ||
+ | colors } | ||
+ | |||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure Bigmsg (x, | ||
+ | { This draws string msg to screen in the bios font, but bigger } | ||
+ | VAR loop1, | ||
+ | BEGIN | ||
+ | for loop1:=1 to length (msg) do | ||
+ | for loop2:=1 to 8 do | ||
+ | for loop3:=1 to 8 do | ||
+ | if (scr[msg[loop1], | ||
+ | for loop4:=1 to 4 do | ||
+ | for loop5:=1 to 8 do | ||
+ | putpixel (x+(loop1*32)+(loop2*4)+loop4, | ||
+ | getpixel (x+(loop1*32)+(loop2*4)+loop4, | ||
+ | END; | ||
+ | END; | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure Static; | ||
+ | { This moves the static and tunes in to our background logo } | ||
+ | VAR loop1, | ||
+ | BEGIN | ||
+ | flip (vaddr2, | ||
+ | Bigmsg (0, | ||
+ | flip (vaddr, | ||
+ | count:=0; | ||
+ | count2:=0; | ||
+ | for loop2:=1 to 100 do BEGIN | ||
+ | waitretrace; | ||
+ | for loop1:=99 to 150 do BEGIN | ||
+ | count: | ||
+ | pal (loop1, | ||
+ | END; | ||
+ | for loop1:=150 to 201 do BEGIN | ||
+ | count: | ||
+ | pal (loop1, | ||
+ | END; | ||
+ | END; { Do the static for a while } | ||
+ | |||
+ | repeat | ||
+ | inc (count); | ||
+ | if count>10 then BEGIN | ||
+ | count:=0; | ||
+ | inc (count2); | ||
+ | END; | ||
+ | waitretrace; | ||
+ | for loop1:=99 to 150 do BEGIN | ||
+ | count3: | ||
+ | if count3<0 then count3:=0; | ||
+ | pal (loop1, | ||
+ | END; | ||
+ | for loop1:=150 to 201 do BEGIN | ||
+ | count3: | ||
+ | count3: | ||
+ | if count3> | ||
+ | pal (loop1, | ||
+ | END; | ||
+ | until count2> | ||
+ | |||
+ | delay (500); | ||
+ | for loop1:=30 to 62 do BEGIN | ||
+ | line (0, | ||
+ | delay (5); | ||
+ | END; | ||
+ | for loop1:=62 downto 30 do BEGIN | ||
+ | line (0, | ||
+ | delay (5); | ||
+ | END; { Erase logo with lines } | ||
+ | delay (1000); | ||
+ | while keypressed do readkey; | ||
+ | END; | ||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure Fadeup; | ||
+ | { This fades up the pallette to white } | ||
+ | VAR loop1, | ||
+ | Tmp : Array [1..3] of byte; | ||
+ | BEGIN | ||
+ | For loop1:=1 to 64 do BEGIN | ||
+ | WaitRetrace; | ||
+ | For loop2:=0 to 255 do BEGIN | ||
+ | Getpal (loop2, | ||
+ | If Tmp[1]< | ||
+ | If Tmp[2]< | ||
+ | If Tmp[3]< | ||
+ | Pal (loop2, | ||
+ | END; | ||
+ | END; | ||
+ | END; | ||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure FadeTo (name: | ||
+ | { This procedure fades the screen to name ... if you use this for yourself, | ||
+ | you will need to cut out the extra stuff I do in here specific to this | ||
+ | program } | ||
+ | VAR loop1, | ||
+ | tmp, | ||
+ | f:file; | ||
+ | BEGIN | ||
+ | assign (f,name); | ||
+ | reset (f,1); | ||
+ | blockread (f, | ||
+ | close (f); | ||
+ | for loop1:=100 to 150 do BEGIN | ||
+ | pall2[loop1, | ||
+ | pall2[loop1, | ||
+ | pall2[loop1, | ||
+ | END; { Set the background colors } | ||
+ | waitretrace; | ||
+ | for loop1:=0 to 255 do | ||
+ | getpal (loop1, | ||
+ | |||
+ | For loop1:=1 to 64 do BEGIN | ||
+ | For loop2:=0 to 255 do BEGIN | ||
+ | If Tmp[loop2, | ||
+ | If Tmp[loop2, | ||
+ | If Tmp[loop2, | ||
+ | If Tmp[loop2, | ||
+ | If Tmp[loop2, | ||
+ | If Tmp[loop2, | ||
+ | END; | ||
+ | WaitRetrace; | ||
+ | for loop2:=0 to 255 do | ||
+ | pal (loop2, | ||
+ | END; | ||
+ | END; | ||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure Show (x, | ||
+ | { This dumps string ch to screen at x,y in our main font } | ||
+ | VAR loop1, | ||
+ | BEGIN | ||
+ | for loop3:=1 to length (ch) do | ||
+ | For loop1:=1 to 16 do | ||
+ | for loop2:=1 to 16 do | ||
+ | if Font^[ch[loop3], | ||
+ | putpixel (x+loop1+(loop3*17), | ||
+ | END; | ||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure Eye_Popper; | ||
+ | { This fades up the colors used in our main font } | ||
+ | VAR Loop1, | ||
+ | tmp : array [1..3] of byte; | ||
+ | BEGIN | ||
+ | if keypressed then exit; | ||
+ | for loop1:=1 to 63 do | ||
+ | for loop2:=1 to 8 do BEGIN | ||
+ | Waitretrace; | ||
+ | Getpal (loop2, | ||
+ | if tmp[1]< | ||
+ | if tmp[2]< | ||
+ | if tmp[3]< | ||
+ | pal (loop2, | ||
+ | END; | ||
+ | for loop1:=151 to 200 do | ||
+ | pal (loop1, | ||
+ | END; | ||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure FadeOutText; | ||
+ | { This fades out the colors of our main font to the colors of the background | ||
+ | static } | ||
+ | VAR Loop1, | ||
+ | tmp : array [1..3] of byte; | ||
+ | BEGIN | ||
+ | if keypressed then exit; | ||
+ | for loop1:=1 to 63 do BEGIN | ||
+ | Waitretrace; | ||
+ | for loop2:=151 to 200 do BEGIN | ||
+ | Getpal (loop2, | ||
+ | if tmp[1]> | ||
+ | if tmp[2]> | ||
+ | if tmp[3]> | ||
+ | pal (loop2, | ||
+ | END; | ||
+ | END; | ||
+ | delay (100); | ||
+ | END; | ||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure Move_Em_Out (num: | ||
+ | { This procedure runs through each pixel that is active and moves it closer | ||
+ | to its destination } | ||
+ | VAR loop2: | ||
+ | BEGIN | ||
+ | if del<> | ||
+ | for loop2:=1 to num do | ||
+ | if nextrow^[loop2].active then with nextrow^[loop2] do BEGIN | ||
+ | putpixel (herex shr sjump,herey shr sjump, | ||
+ | getpixel (herex shr sjump,herey shr sjump, | ||
+ | { Restore old bacground } | ||
+ | herex: | ||
+ | herey: | ||
+ | putpixel (herex shr sjump,herey shr sjump, | ||
+ | dec (num); | ||
+ | if num=0 then BEGIN | ||
+ | active: | ||
+ | putpixel (herex shr sjump,herey shr sjump, | ||
+ | END; { If destination reached, deactivate } | ||
+ | END; | ||
+ | END; | ||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure Doletter (msg : char; dx,dy : integer); | ||
+ | { This procedure activates the pixels necessary to draw a letter } | ||
+ | VAR loop1, | ||
+ | x,y : Integer; | ||
+ | BEGIN | ||
+ | if keypressed then exit; | ||
+ | for loop2:=1 to 16 do BEGIN | ||
+ | for loop1:=1 to 16 do { Our font is 16x16 } | ||
+ | if Font^[msg, | ||
+ | if dir then PosLoop: | ||
+ | else PosLoop: | ||
+ | if PosLoop=315 then PosLoop:=1; | ||
+ | if PosLoop=0 then PosLoop: | ||
+ | X: | ||
+ | y: | ||
+ | |||
+ | nextrow^ [counter].herex: | ||
+ | nextrow^ [counter].herey: | ||
+ | { This is where I am } | ||
+ | nextrow^ [counter].targx: | ||
+ | nextrow^ [counter].targy: | ||
+ | { This is where I want to be } | ||
+ | nextrow^ [counter].dx: | ||
+ | nextrow^ [counter].dy: | ||
+ | { This is how I get there } | ||
+ | nextrow^ [counter].col: | ||
+ | nextrow^ [counter].active: | ||
+ | nextrow^ [counter].num: | ||
+ | move_em_out(jump, | ||
+ | |||
+ | inc (counter); | ||
+ | if counter=jump+1 then counter:=1; | ||
+ | END; | ||
+ | END; | ||
+ | END; | ||
+ | |||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure DoPic; | ||
+ | { This procedure morphs in the tank } | ||
+ | VAR f:file; | ||
+ | ch:byte; | ||
+ | count, | ||
+ | ourpal : array [0..255, | ||
+ | BEGIN | ||
+ | cls (vaddr,0); | ||
+ | getmem (nextrow, | ||
+ | GetMem(Vir2, | ||
+ | Vaddr2 := Seg(Vir2^); | ||
+ | for loop2:=1 to 4095 do | ||
+ | nextrow^[loop2].active: | ||
+ | |||
+ | assign (f,' | ||
+ | reset (f,1); | ||
+ | seek (f,32); | ||
+ | blockread (f, | ||
+ | for loop1:=0 to 255 do | ||
+ | pal (loop1, | ||
+ | count:=1; | ||
+ | for loop2:=1 to 60 do | ||
+ | for loop1:=1 to 160 do BEGIN | ||
+ | blockread (f, | ||
+ | pixels } | ||
+ | if ch<>0 then BEGIN | ||
+ | nextrow^ [count].herex: | ||
+ | nextrow^ [count].herey: | ||
+ | { This is where I am } | ||
+ | nextrow^ [count].targx: | ||
+ | nextrow^ [count].targy: | ||
+ | { This is where I want to be } | ||
+ | nextrow^ [count].dx: | ||
+ | nextrow^ [count].dy: | ||
+ | { This is how I get there } | ||
+ | nextrow^ [count].col: | ||
+ | nextrow^ [count].active: | ||
+ | nextrow^ [count].num: | ||
+ | inc (count); | ||
+ | END; | ||
+ | END; | ||
+ | close (f); | ||
+ | for loop1:=0 to 64 do | ||
+ | move_em_out (count, | ||
+ | delay (2000); | ||
+ | fadeup; | ||
+ | END; | ||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure Init; | ||
+ | VAR f:file; | ||
+ | loop1, | ||
+ | loopie: | ||
+ | BEGIN | ||
+ | getmem (Font, | ||
+ | |||
+ | for loop2:=1 to jump do | ||
+ | nextrow^[loop2].active: | ||
+ | |||
+ | Assign(f,' | ||
+ | Reset(f,1); | ||
+ | Blockread(F, | ||
+ | Close(f); | ||
+ | |||
+ | assign (f,' | ||
+ | reset (f,1); | ||
+ | Blockread (f, | ||
+ | close (f); | ||
+ | |||
+ | counter:=1; | ||
+ | PosLoop:=1; | ||
+ | dir:=true; | ||
+ | loopie:=0; | ||
+ | for loop1:=1 to 314 do BEGIN | ||
+ | loopie: | ||
+ | pathX[loop1]: | ||
+ | pathy[loop1]: | ||
+ | END; { Generate our path of origination } | ||
+ | cls (vga,0); | ||
+ | cls (vaddr,0); | ||
+ | cls (vaddr2,0); | ||
+ | for loop1:=0 to 319 do | ||
+ | for loop2:=0 to 199 do | ||
+ | putpixel (loop1, | ||
+ | flip (vaddr2, | ||
+ | flip (vaddr, | ||
+ | fadeto (' | ||
+ | for loop1:=1 to 8 do | ||
+ | getpal (loop1, | ||
+ | END; | ||
+ | |||
+ | |||
+ | {ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ} | ||
+ | Procedure Play; | ||
+ | VAR loop1, | ||
+ | message : Array [1..10] of string; | ||
+ | BEGIN | ||
+ | DoPic; | ||
+ | init; | ||
+ | while keypressed do readkey; | ||
+ | | ||
+ | message[1]: | ||
+ | message[2]: | ||
+ | message[3]: | ||
+ | message[4]: | ||
+ | message[5]: | ||
+ | message[6]: | ||
+ | message[7]: | ||
+ | message[9]: | ||
+ | | ||
+ | for loop2:=1 to 7 do BEGIN | ||
+ | For loop1:=1 to length (message[loop2]) do BEGIN | ||
+ | doletter (message[loop2][loop1], | ||
+ | dir: | ||
+ | END; | ||
+ | for loop1:=1 to jump do move_em_out(jump, | ||
+ | END; | ||
+ | |||
+ | eye_popper; | ||
+ | For loop1:=1 to 7 do | ||
+ | show (0, | ||
+ | fadeouttext; | ||
+ | flip (vaddr2, | ||
+ | flip (vaddr, | ||
+ | |||
+ | for loop1:=1 to 8 do | ||
+ | pal (loop1, | ||
+ | message[1]: | ||
+ | For loop1:=1 to length (message[1]) do BEGIN | ||
+ | if message[1][loop1]=' | ||
+ | move_em_out(jump, | ||
+ | doletter (message[1][loop1], | ||
+ | dir: | ||
+ | END; | ||
+ | for loop1:=1 to jump do move_em_out(jump, | ||
+ | |||
+ | eye_popper; | ||
+ | show (0, | ||
+ | fadeouttext; | ||
+ | |||
+ | static; | ||
+ | |||
+ | freemem (vir2, | ||
+ | END; | ||
+ | |||
+ | |||
+ | BEGIN | ||
+ | clrscr; | ||
+ | writeln ('Hi there ... welcome to the seventeenth Asphyxia VGA Trainer ... and'); | ||
+ | writeln ('the last one on demo effects for a while ... I am going to be doing' | ||
+ | writeln ('more work on the theory aspect in future trainers.' | ||
+ | writeln; | ||
+ | writeln ('This is an effect I first saw in an Extreme demo, and features '' | ||
+ | writeln (' | ||
+ | writeln ('and a static routine.' | ||
+ | writeln; | ||
+ | writeln (' | ||
+ | writeln; | ||
+ | writeln ('The tank was drawn by Fubar a while ago when he was starting to learn' | ||
+ | writeln ('3D Studio. The font I found somewhere on my hard drive.' | ||
+ | writeln; | ||
+ | writeln; | ||
+ | writeln ('Hit any key to continue ...'); | ||
+ | readkey; | ||
+ | setmcga; | ||
+ | setupvirtual; | ||
+ | play; | ||
+ | settext; | ||
+ | shutdown; | ||
+ | Writeln ('All done. This concludes the seventeenth sample program in the ASPHYXIA' | ||
+ | Writeln (' | ||
+ | Writeln (' | ||
+ | Writeln (' | ||
+ | Writeln (' | ||
+ | Writeln ('The numbers are available in the main text. You may also write to me at:'); | ||
+ | Writeln (' | ||
+ | Writeln (' | ||
+ | Writeln (' | ||
+ | Writeln (' | ||
+ | Writeln (' | ||
+ | Writeln (' | ||
+ | Writeln ('I hope to hear from you soon!' | ||
+ | Writeln; Writeln; | ||
+ | Write | ||
+ | readkey; | ||
+ | END. | ||
+ | </ | ||
+ | |||
+ | ==== In closing ==== | ||
+ | |||
+ | Well, that is about it ... as I say, I will be doing more theory stuff in future, as individual demo effects can be thought up if you know the base stuff. | ||
+ | |||
+ | Note the putpixel in this GFX3.PAS unit ... it is _very_ fast .. but remember, just calling a procedure eats clock ticks... so imbed putpixels in your code if you need them. Most of the time a putpixel is not needed though. | ||
+ | |||
+ | PCGPE ][ will be out on the 10th of Feburary. All the new tutors will be on it (if you aren't reading this from it right now! ;-) ... grab a copy of it, it is a very useful ting to have handy. | ||
+ | |||
+ | I have found out that these tutors have been distributed inside paper magazines ... please remember that Denthor and Asphyxia retain full copyright to the series (as mentioned earlier in the series), and if you want to use a version in a magazine, CONTACT ME FIRST ... I will probably also modify it/cut out various unneccesary things ... other then that, you must not alter the files without my permission, or at least leave a copy of the origional with the update. Maybe I could even start up a nice column for some magazine or other :) | ||
+ | |||
+ | Sorry 'bout that, but it had to be said ... | ||
+ | |||
+ | I am writing a column for the Demuan list, a Florida-based electronic magazine ... pick it up off ftp.eng.ufl.edu ... I have written various articles, all bordering on quote-like design. | ||
+ | |||
+ | There are more BBS's to be added to the list at the end, but I don't have them here... this tut has taken long enough ;-) | ||
+ | |||
+ | Byeeeee.... | ||
+ | Denthor | ||
+ | |||
+ | The following are official ASPHYXIA distribution sites : | ||
+ | |||
+ | < | ||
+ | ╔══════════════════════════╦════════════════╦═════╗ | ||
+ | ║BBS Name ║Telephone No. | ||
+ | ╠══════════════════════════╬════════════════╬═════╣ | ||
+ | ║ASPHYXIA BBS #1 | ||
+ | ║ASPHYXIA BBS #2 | ||
+ | ║C-Spam BBS ║410-531-5886 | ||
+ | ║POP! | ||
+ | ║Soul Asylum | ||
+ | ║Wasted Image ║407-838-4525 | ||
+ | ║Reckless Life | ||
+ | ║Mach 5 BBS ║+1 319-355-7336 ║ALL | ||
+ | ╚══════════════════════════╩════════════════╩═════╝ | ||
+ | </ | ||
+ | |||
+ | Leave me mail if you want to become an official Asphyxia BBS distribution site. | ||
+ | |||
+ | ===== Download Original files ===== | ||
+ | |||
+ | You can find the original publication file {{TUT17.ZIP|here}} | ||
+ | |||
+ | <nspages back2root/ |