Worklog for Apocalypse
Worklog 1
Return to Worklogs
| ||
www.imakegames.com/B3DHLP.dll ; Userlib .lib "kernel32.dll" GlobalSize%(hMem%) .lib "B3DHLP.dll" AVIBltFrameToImage% (AVIObject%, pBits%, pBBImage%, FramePtr%):"AVIBLTFRAMETOIMAGE" AVIBltFrameToTex% (AVIObject%, pBits%, pBBTex%, FramePtr):"AVIBLTFRAMETOTEX" AVIClose% (AVIObject%):"AVICLOSE" AVICloseLib% ():"AVICLOSELIB" AVIGetFrame% (AVIObject%, Pos%):"AVIGETFRAME" AVIGetFrameRate% (AVIObject%):"AVIGETFRAMERATE" AVIGetHeight% (AVIObject%):"AVIGETHEIGHT" AVIGetImageSize% (AVIObject%):"AVIGETIMAGESIZE" AVIGetTotalFrames% (AVIObject%):"AVIGETTOTALFRAMES" AVIGetWidth% (AVIObject%):"AVIGETWIDTH" AVIOpen% (Filename$):"AVIOPEN" AVIOpenLib ():"AVIOPENLIB" BankToDIB% (pBank%, width%, height%, bitcount%):"BANKTODIB" BankToImage% (pBank%,pBBImage%,FramePtr%):"BANKTOIMAGE" BltDIBToImage% (pDIB%, pBBImage%, FramePtr%):"BLTDIBTOIMAGE" CheckTimer% (hTimer%):"CHECKTIMER" DebugOut% (OutStr$):"DEBUGOUT" Deg2Rad# (Degrees#):"DEG2RAD" DestroyTimer% (hTimer%):"DESTROYTIMER" DirExists% (DirName$):"DIREXISTS" DiskSpaceFree% (Drive$):"DISKSPACEFREE" DiskSpaceTotal% (Drive$):"DISKSPACETOTAL" Distance# (x1#, y1#, x2#, y2#):"DISTANCE" FileExists% (Filename$):"FILEEXISTS" FreePointer% (pMem%):"FREEPOINTER" FreeRAM% ():"FREERAM" GetDIBdc% (pDIB%):"GETDIBDC" GetDIBlpBits% (pDIB%):"GETDIBLPBITS" Hex2Dec% (HexVal$):"HEX2DEC" ImageBrightness% (pBBImage%, FramePtr%, Change%):"IMAGEBRIGHTNESS" ImageToBank% (pBBImage%,FramePtr%,pBank%):"IMAGETOBANK" ImageToDIB% (pBBImage%, FramePtr%):"IMAGETODIB" LoadBank% (pBank%, Filename$):"LOADBANK" MakeTimer% (IntPerSec$):"MAKETIMER" Now$ ():"NOW" OriginAngle# (x#,y#):"ORIGINANGLE" Rad2Deg# (Radians#):"RAD2DEG" ReadBankByte% (pBank%, Index%):"READBANKBYTE" ReadBankInt% (pBank%, Index%):"READBANKINT" ReadBankShort% (pBank%, Index%):"READBANKSHORT" ReleaseDIB% (pDIB%):"RELEASEDIB" ReleaseDLL% ():"RELEASEDLL" ResetBit% (dwVal%, BitPos%):"RESETBIT" SaveBank% (pBank%, Filename$):"SAVEBANK" SetBit% (dwVal%, BitPos%):"SETBIT" TestBit% (dwVal%, BitPos%):"TESTBIT" TimeServerSet% (Host$):"TIMESERVERSET" TimeServerGet$ (Host$):"TIMESERVERGET" TotalRAM% ():"TOTALRAM" WriteBankByte% (pBank%, Index%, inVal%):"WRITEBANKBYTE" WriteBankInt% (pBank%, Index%, inVal%):"WRITEBANKINT" WriteBankShort% (pBank%, Index%, inVal%):"WRITEBANKSHORT" ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
Here are some routines I added mainly because they are optimized for
speed plus they've helped me in the past in making enemy AI...Graphics 640,480,0,2 Print Distance (0,0,10,10) Print OriginAngle(10,10) Print Rad2Deg (OriginAngle(10,10)) Print Deg2Rad(315) OriginAngle... This function will return the angle from origin 0,0 to X,Y Useful to figure out in which direction a set of coordinates is from another. By taking 2 sets of coordinates and normalizing them (ie: subtract X2-X1, Y2-Y1) will let you find the angle of any coordinate (X1,Y1) to any other coordinate. (X2,Y2) ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
Pretty straight forward and very FAST!Graphics 640,480,0,2 Print Hex2Dec ("eFFFFFFF") ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
This function just returns the time as a string...Graphics 640,480,0,2 Print TimeServerGet("time-a.nist.gov") ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
Here is a function to set your time from an internet clock... ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
I've made some internal changes to try and address some users having
trouble passing string data to certain functions. Also I have
temporarily removed the FmtStr$ function until I get it working
properly... Latest Download www.imakegames.com/B3DHLP.dll Latest .decls ; Userlib .lib "kernel32.dll" GlobalSize%(hMem%) .lib "B3DHLP.dll" AVIBltFrameToImage% (AVIObject%, pBits%, pBBImage%, FramePtr%):"AVIBLTFRAMETOIMAGE" AVIBltFrameToTex% (AVIObject%, pBits%, pBBTex%, FramePtr):"AVIBLTFRAMETOTEX" AVIClose% (AVIObject%):"AVICLOSE" AVICloseLib% ():"AVICLOSELIB" AVIGetFrame% (AVIObject%, Pos%):"AVIGETFRAME" AVIGetFrameRate% (AVIObject%):"AVIGETFRAMERATE" AVIGetHeight% (AVIObject%):"AVIGETHEIGHT" AVIGetImageSize% (AVIObject%):"AVIGETIMAGESIZE" AVIGetTotalFrames% (AVIObject%):"AVIGETTOTALFRAMES" AVIGetWidth% (AVIObject%):"AVIGETWIDTH" AVIOpen% (Filename$):"AVIOPEN" AVIOpenLib ():"AVIOPENLIB" BankToDIB% (pBank%, width%, height%, bitcount%):"BANKTODIB" BankToImage% (pBank%,pBBImage%,FramePtr%):"BANKTOIMAGE" BltDIBToImage% (pDIB%, pBBImage%, FramePtr%):"BLTDIBTOIMAGE" CheckTimer% (hTimer%):"CHECKTIMER" DebugOut% (OutStr$):"DEBUGOUT" Deg2Rad# (Degrees#):"DEG2RAD" DestroyTimer% (hTimer%):"DESTROYTIMER" DirExists% (DirName$):"DIREXISTS" DiskSpaceFree% (Drive$):"DISKSPACEFREE" DiskSpaceTotal% (Drive$):"DISKSPACETOTAL" Distance# (x1#, y1#, x2#, y2#):"DISTANCE" FileExists% (Filename$):"FILEEXISTS" FreePointer% (pMem%):"FREEPOINTER" FreeRAM% ():"FREERAM" GetDIBdc% (pDIB%):"GETDIBDC" GetDIBlpBits% (pDIB%):"GETDIBLPBITS" Hex2Dec% (HexVal$):"HEX2DEC" ImageToBank% (pBBImage%,FramePtr%,pBank%):"IMAGETOBANK" ImageToDIB% (pBBImage%, FramePtr%):"IMAGETODIB" LoadBank% (pBank%, Filename$):"LOADBANK" MakeTimer% (IntPerSec$):"MAKETIMER" Now$ ():"NOW" OriginAngle# (x#,y#):"ORIGINANGLE" Rad2Deg# (Radians#):"RAD2DEG" ReadBankByte% (pBank%, Index%):"READBANKBYTE" ReadBankInt% (pBank%, Index%):"READBANKINT" ReadBankShort% (pBank%, Index%):"READBANKSHORT" ReleaseDIB% (pDIB%):"RELEASEDIB" ReleaseDLL% ():"RELEASEDLL" ResetBit% (dwVal%, BitPos%):"RESETBIT" SaveBank% (pBank%, Filename$):"SAVEBANK" SetBit% (dwVal%, BitPos%):"SETBIT" TestBit% (dwVal%, BitPos%):"TESTBIT" TimeServerSet% (Host$):"TIMESERVERSET" TimeServerGet$ (Host$):"TIMESERVERGET" TotalRAM% ():"TOTALRAM" WriteBankByte% (pBank%, Index%, inVal%):"WRITEBANKBYTE" WriteBankInt% (pBank%, Index%, inVal%):"WRITEBANKINT" WriteBankShort% (pBank%, Index%, inVal%):"WRITEBANKSHORT" ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
Read and Write to Banks as if they were arrays of bytes/Shorts or Integers!... ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
The latest feature is the ability to Blt AVI frames to a Texture. With that you can play an AVI on a spinning cube! ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
Tweaked the DLL to be more efficient in what/where and when DirectX
objects are allocated/deallocated. Clocked AVIBltFrameToImage at 4.7ms. Need to work on some proper Docs now. ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
I cleaned up my demo code. This one shows how to load all the frames of
a short AVI clip into a multi-frame image, then play them back at
speed. ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
I have created several new functions for reading AVI frame information
and copying the frames to a BBImage. Check out the demo source here and
.decls at the bottom. ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
Several new functions deal with taking info stored in a Bank or Image
and creating a DIB (Device Independent Bitmap). With a DIB you can then
work directly with the pixel data via a memory pointer, or Blt the data
using the DIB's DC...Graphics 640,480,0,2 im=CreateImage (320,240) SizeNeeded = ImageToBank (im,0,0) ;Pass zero for bank to return size needed bk = CreateBank(SizeNeeded) hDIB = BankToDIB(bk,320,240,32) hDIB2 = ImageToDIB(im,0) DIBdc = GetDIBdc (hDIB) pBits = GetDIBlpBits(hdib) While Not KeyHit(1) Wend ReleaseDIB hDIB YAAAWWWNN!! 2am. Time for some sleep.. :) ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
I have been successful in my attempts to access Blitz's DX7 surface object for images. I have added new functions... ImageToBank to allow the transfer of image data from a Blitz image to a memory bank... BankToImage does the reverse... Graphics 640,480,0,2 im=CreateImage (320,240) SizeNeeded = ImageToBank (im,0,0) ;Pass zero for bank to return size needed bk = CreateBank(SizeNeeded) If ImageToBank(im,0,bk)=1 Then Print "Image Data Transferred to Bank" EndIf If BankToImage(bk,im,0)=1 Then Print "Image Data Transferred from Bank" EndIf While Not KeyHit(1) Wend ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
I have added a few new functions to B3DHLP.DLL... DebugOut - Outputs a string to a debugger like WinDbg Timer Functions - These functions allow you to create timed blocks of code that only execute every so many times/second -------------------------------------------------------- CreateTimer CheckTimer DestroyTimer Graphics 640,480,0,2 hTimer = MakeTimer (5) While Not KeyHit(1) If CheckTimer (hTimer) =1 Then Print "This Block Executes at 5 Times/Sec" EndIf Wend DestroyTimer hTimer ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |
| ||
I've started work on a helper DLL for Blitz3D and was wondering if
anyone would be interested in trying it out and maybe making some
suggestions as to added functions. I intend to release the DLL as
freeware when I am done. All I would ask is that I am listed in the
credits somewhere if you use it. Download the DLL here... http://www.imakegames.com/B3DHLP.dll Here are the functions I've done so far... --------------------------------------------- FmtStr$ - allows you to format a number like "#,###.00" (This function suffers from Blitz's lack of extended precision) DebugOut% - displays text to the debugger if one is in use (ie: WinDbg) DiskSpaceFree - Returns free Space of HD in megabytes DiskSpaceTotal - Returns total space of HD in megabytes SetBit - Allows setting an individual bit of a variable ResetBit - Allows resetting an individial bit of a variable TestBit - Returns whether a bit is on or off in a variable MakeTimer - Creates a timer which turns True at so many intervals/sec CheckTimer - Checks a particular timer to see if it's interval has passed DestroyTimer - Frees the memory used by the timer FileExists% - Check to see if a file exists DirExists% - Check to see if a directory exists SaveBank - Allows you to save the entire contents of a Bank at once LoadBank - Allows you to load an entire Bank's contents from a file. ImageToBank - Copies the pixel data from an Image to a Bank BankToImage - Copies the data from a bank to an Image BankToDIB - Converts the data in a Bank to a DIB (Device Independent Bitmap) ReleaseDIB - Free memory used by DIB GetDIBDC% - Returns the device context of a DIB (Can be used for Blitting operations) GetDIBlpBits% - Returns a memory pointer to the pixel data of a DIB Here are the .decls... ; Userlib .lib "B3DHLP.dll" AVIBltFrameToImage% (AVIObject%, pBits%, pBBImage%, FramePtr%):"AVIBLTFRAMETOIMAGE" AVIBltFrameToTex% (AVIObject%, pBits%, pBBTex%, FramePtr):"AVIBLTFRAMETOTEX" AVIClose% (AVIObject%):"AVICLOSE" AVICloseLib% ():"AVICLOSELIB" AVIGetFrame% (AVIObject%, Pos%):"AVIGETFRAME" AVIGetFrameRate% (AVIObject%):"AVIGETFRAMERATE" AVIGetHeight% (AVIObject%):"AVIGETHEIGHT" AVIGetImageSize% (AVIObject%):"AVIGETIMAGESIZE" AVIGetTotalFrames% (AVIObject%):"AVIGETTOTALFRAMES" AVIGetWidth% (AVIObject%):"AVIGETWIDTH" AVIOpen% (Filename$):"AVIOPEN" AVIOpenLib ():"AVIOPENLIB" BankToDIB% (pBank%, width%, height%, bitcount%):"BANKTODIB" BankToImage% (pBank%,pBBImage%,FramePtr%):"BANKTOIMAGE" BltDIBToImage% (pDIB%, pBBImage%, FramePtr%):"BLTDIBTOIMAGE" CheckTimer% (hTimer%):"CHECKTIMER" DebugOut% (OutStr$):"DEBUGOUT" DestroyTimer% (hTimer%):"DESTROYTIMER" DirExists% (DirName$):"DIREXISTS" DiskSpaceFree% (Drive$):"DISKSPACEFREE" DiskSpaceTotal% (Drive$):"DISKSPACETOTAL" FileExists% (Filename$):"FILEEXISTS" FmtStr$ (InVal$ , pFmt$):"FMTSTR" FreePointer% (pMem%):"FREEPOINTER" FreeRAM% ():"FREERAM" GetDIBdc% (pDIB%):"GETDIBDC" GetDIBlpBits% (pDIB%):"GETDIBLPBITS" ImageToBank% (pBBImage%,FramePtr%,pBank%):"IMAGETOBANK" ImageToDIB% (pBBImage%, FramePtr%):"IMAGETODIB" LoadBank% (pBank%, Filename$):"LOADBANK" MakeTimer% (IntPerSec$):"MAKETIMER" Now$ ():"NOW" ReadBankByte% (pBank%, Index%):"READBANKBYTE" ReadBankInt% (pBank%, Index%):"READBANKINT" ReadBankShort% (pBank%, Index%):"READBANKSHORT" ReleaseDIB% (pDIB%):"RELEASEDIB" ReleaseDLL% ():"RELEASEDLL" ResetBit% (dwVal%, BitPos%):"RESETBIT" SaveBank% (pBank%, Filename$):"SAVEBANK" SetBit% (dwVal%, BitPos%):"SETBIT" TestBit% (dwVal%, BitPos%):"TESTBIT" TotalRAM% ():"TOTALRAM" WriteBankByte% (pBank%, Index%, inVal%):"WRITEBANKBYTE" WriteBankInt% (pBank%, Index%, inVal%):"WRITEBANKINT" WriteBankShort% (pBank%, Index%, inVal%):"WRITEBANKSHORT" ------------------------- Apocalypse Desktop: TRS-80 Model 3 with 48k and Cassette Recorder Laptop: TRS-80 Model 100 with Acoustic Coupler |