Code: Select all
;
; https://www.squarefree.com/2003/09/19/debris-32/
;
; direct download link:
; http://www.squarefree.com/mirrors/deb3210.exe
;
EnableExplicit
Structure PBPixelStructure
B.a
G.a
R.a
EndStructure
Structure RGBStructure
R.a
G.a
B.a
EndStructure
IncludeFile "Debris32_Palette.pbi"
Define.a Byte
Define.i File, x, y, BytesPerPixel, LinePaddingBytes, Img, Pictures, i, XPos, YPos, YPictures, Event, MaxImageHeight, LastX, LastY
Define Filename$, ExtractDirName$
Define *FileBuffer, *FilePtr.Ascii, *ImgBuffer, *ImgPtr.PBPixelStructure, *ColorPtr.RGBStructure
Filename$ = OpenFileRequester("Choose a ThruSet dat file", "", "dat|THRUSET*.dat", 0)
If Filename$
File = ReadFile(#PB_Any, Filename$)
If File
*FileBuffer = AllocateMemory(Lof(File), #PB_Memory_NoClear)
If *FileBuffer
If ReadData(File, *FileBuffer, MemorySize(*FileBuffer)) = MemorySize(*FileBuffer)
*FilePtr = *FileBuffer
If CreateImage(100, 18, 24, 24)
If StartDrawing(ImageOutput(100))
*ImgBuffer = DrawingBuffer()
LinePaddingBytes = DrawingBufferPitch() - 18 * 3
*ImgPtr = *ImgBuffer
For y = 0 To 23
For x = 0 To 17
*ColorPtr = ?Debris32PCXPalette + *FilePtr\a * 3
*ImgPtr\B = *ColorPtr\B
*ImgPtr\G = *ColorPtr\G
*ImgPtr\R = *ColorPtr\R
*ImgPtr + 3
*FilePtr + 1
Next x
*ImgPtr + LinePaddingBytes
Next y
StopDrawing()
EndIf
EndIf
GrabImage(100, 0, 0, 0, 9, 8)
GrabImage(100, 1, 9, 0, 9, 8)
GrabImage(100, 2, 0, 8, 9, 8)
GrabImage(100, 3, 9, 8, 9, 8)
GrabImage(100, 4, 0, 16, 9, 4)
GrabImage(100, 5, 9, 16, 9, 4)
GrabImage(100, 6, 0, 20, 9, 4)
GrabImage(100, 7, 9, 20, 9, 4)
OpenWindow(0, 0, 0, 200, 100, GetFilePart(Filename$, #PB_FileSystem_NoExtension), #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
x = 0
y = 0
For i = 0 To 7
If ImageWidth(i) <> LastX
x = 0
LastX = ImageWidth(i)
LastY = ImageHeight(i)
y + MaxImageHeight + 2
MaxImageHeight = 0
ElseIf ImageHeight(i) <> LastY
x = 0
LastX = ImageWidth(i)
LastY = ImageHeight(i)
y + MaxImageHeight + 2
MaxImageHeight = LastY
EndIf
ImageGadget(i, x, y, 0, 0, ImageID(i))
x + ImageWidth(i) + 2
If ImageHeight(i) > MaxImageHeight
MaxImageHeight = ImageHeight(i)
EndIf
If x > 800 - ImageWidth(i)
x = 0
y + MaxImageHeight + 2
MaxImageHeight = 0
EndIf
Next i
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
SetClipboardImage(EventGadget())
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
EndIf
FreeMemory(*FileBuffer)
EndIf
CloseFile(File)
EndIf