home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Underground
/
UNDERGROUND.ISO
/
graphic
/
fade.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-07-28
|
2KB
|
63 lines
Unit fade;
{used to fade a picture (part) that has just been displayed into a new one}
Interface
Uses ModeXLib;
Var Colors:Word; {Number of colors per single frame}
Procedure fade_ResetPic(y,Height:Word);
Procedure Fade1(Pic:Pointer;Pal:Array of Byte; Start,y,Height:Word);
Implementation
Var i,j:Word; {temporary counter}
Destination_Pal:Array[0..768] of Byte; {temporary destination palette}
Procedure fade_set(Source:Pointer;Start,y,Height:Word);external;
{"mixes" source with VGA-Ram}
{use source beginning at Start line and VGA-Ram beginning at y line at height of Height}
Procedure fade_ResetPic(y,Height:Word);external;
{prepares faded picture for another fade}
{reduction of "Colors^2" to "Colors" colors}
{here again y=line in VGA-Ram, Height=Height of area to be edited}
{$l fade}
Procedure fade_CopyPal;
{multiply palette on Colors^2 (multiply non-homogenous Block 0)}
Begin
For i:=1 to Colors do
Move(Palette[0],Palette[i*3*Colors],Colors*3);
End;
Procedure fade_spread(Var Pal:Array of Byte);
{spread palette to Colors^2 (multiply each color separately)}
{the homogenous blocks are formed here from the colors 0..Colors-1}
Begin
For i:= 0 to Colors-1 do {edit each color separately}
For j:=0 to Colors -1 do {write Colors once each time}
Move(Pal[i*3],Pal[(i+1)*3*Colors+j*3],3);
End;
Procedure Fade1(Pic:Pointer;Pal:Array of Byte; Start,y,Height:Word);
{Fades from current visible picture to Pic (with Palette Pal). During
this process, in the "Start" row, the program begins copying "Height"
rows to the y-coordinate y of the current picture.}
Begin
WaitRetrace; {synchronization}
fade_CopyPal; {multiply block in current palette}
SetPal; {reset this palette}
Move(Palette,Destination_Pal,768); {keep original palette parts}
Move(pal,Destination_Pal,Colors*3); {load destination palette}
fade_spread(Destination_pal); {spread destination palette blocks}
fade_set(pic,start,y,height); {mix in new picture}
fade_to(Destination_pal,1); {and fade}
End;
Begin
Colors:=15; {only default value !}
End.