i'll be posting up a good few of these over the comming week for DarkBasic Standard/Enhanced/Professional, you can basically think of these as premade shortcuts for caluclations that normally you'd have to figure out yourself.
RavenStd.h.dba
remstart
/*
Author: Raven Vegeta [Robert Lettan]
Version: 0.0.1.0
Date: 03-03-2003
*/
remend
`** RavenStd.h.dba ****
remstart
/* Place this within your main game dba //
TRUE = 1
FALSE = 0
void = 0
_Sprite = ( bitLeft( asc( "R" ),16 ) ) + ( bitLeft( asc( "P" ),8 ) ) + ( asc( "S" ) )
_Bitmap = ( bitLeft( asc( "P" ),16 ) ) + ( bitLeft( asc( "M" ),8 ) ) + ( asc( "B" ) )
_File = ( bitLeft( asc( "E" ),16 ) ) + ( bitLeft( asc( "L" ),8 ) ) + ( asc( "F" ) )
_Memblock = ( bitLeft( asc( "K" ),16 ) ) + ( bitLeft( asc( "B" ),8 ) ) + ( asc( "M" ) )
_Image = ( bitLeft( asc( "G" ),16 ) ) + ( bitLeft( asc( "M" ),8 ) ) + ( asc( "I" ) )
_Object = ( bitLeft( asc( "J" ),16 ) ) + ( bitLeft( asc( "B" ),8 ) ) + ( asc( "O" ) )
iBool = 2
iBit = 8
iByte = 256
iWord = 65535
iDword = 2147483648
*/
remend
`// BitShift >
function BitRight( dwInput, dwStep )
`// private declarations
dwReturn = dwInput / ( iBool^dwStep )
endfunction dwReturn
`// AutoMatic Resource Allocation
function ALLOCATE( dwType )
`// private declarations
dwIndex = 1 :`// set default search value
`// automatically allocate selected resource at next available space
select dwType
`// sprite
case _Sprite
while sprite exist( dwIndex ) = TRUE
inc dwIndex
if dwIndex > iWord then dwIndex = 0 : end
endwhile
endcase
`// bitmap
case _Bitmap
while bitmap exist( dwIndex ) = TRUE
inc dwIndex
if dwIndex > ( iByte/iBit ) then dwIndex = 0 : end
endwhile
endcase
`// file
case _File
while file exist( dwIndex ) = TRUE
inc dwIndex
if dwIndex > ( iByte/iBit ) then dwIndex = 0 : end
endwhile
endcase
`// memblock
case _Memblock
while memblock exist( dwIndex ) = TRUE
inc dwIndex
if dwIndex > iWord then dwIndex = 0 : end
endwhile
endcase
`// image
case _Image
while image exist( dwIndex ) = TRUE
inc dwIndex
if dwIndex > iWord then dwIndex = 0 : end
endwhile
endcase
`// Object
case _Object
while object exist( dwIndex ) = TRUE
inc dwIndex
if dwIndex > iWord then dwIndex = 0 : end
endwhile
endcase
endselect
dwReturn = dwIndex :`// allocate number found ... if 0 means no available spaces
endfunction dwReturn
`/* Copyright© 2003 Robert Lettan, FMTau Labs, L,L,C. All Rights Reserved. */
DarkBasic Professional users can drop the .dba at the end, this is only for back compatibility
as i'm plugging these out i won't actually be testing them as i build them - so feel free to post up bugs you get
Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?