Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Verrigans Image System
#1
Difficulty: 4/5
This isnt of super difficulty, but if you need any help, the thing i will tell you to download comes with a nice help file. Btw, im only giving the code for loading one of the surfaces, you cna mod it to fit the rest.


Download this:
http://www.verrigan.net/bitmaputils/VWBitmapUtils.zip

Now open your client, go into the reference menu (Project->References)

Now for the code to load, tiles, and the breakdown

In modDirectX at the top of initsurfaces() add

Code:
Dim DC As Long

Dim BMUtil As BitmapUtils

Set BMUtil = New BitmapUtils




Heres the code for the tiles:

Code:
' Init tiles ddsd type and load the bitmap
    Call BMUtil.LoadByteData(FileName & "tiles" & GFX_EXT)
    Call BMUtil.DecryptByteData("47dn45")
    Call BMUtil.DecompressByteData
    With DDSD_Tile
        .lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
        .ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_VIDEOMEMORY
        .lWidth = BMUtil.ImageWidth
        .lHeight = BMUtil.ImageHeight
    End With
    Set DD_TileSurf = DD.CreateSurface(DDSD_Tile)
    DC = DD_TileSurf.GetDC
    Call BMUtil.Blt(DC)
    Call DD_TileSurf.ReleaseDC(DC)
    DD_TileSurf.SetColorKey DDCKEY_SRCBLT, Key

now for a break down


Code:
' Init tiles ddsd type and load the bitmap
    Call BMUtil.LoadByteData(FileName & "tiles" & GFX_EXT)


This loads the file as byte data ready for reading. GFX_EXT (modConstants i believe) will be changed later on.


Code:
Call BMUtil.DecryptByteData("47dn45")


This decrypts the data you jsut loaded, making sure the key in the " " matches the key for the file your loading (the key is set initially in the BMUtil.exe


Code:
Call BMUtil.DecompressByteData


Simple enough, thsi takes the decrypted data and decompresses it while its still in the memory.

Code:
With DDSD_Tile
        .lFlags = DDSD_CAPS Or DDSD_HEIGHT Or DDSD_WIDTH
        .ddsCaps.lCaps = DDSCAPS_OFFSCREENPLAIN Or DDSCAPS_VIDEOMEMORY
        .lWidth = BMUtil.ImageWidth
        .lHeight = BMUtil.ImageHeight
    End With


This gets the images height and width, and sets the surfaces height and width tot he same thing.

Code:
Set DD_TileSurf = DD.CreateSurface(DDSD_Tile)
    DC = DD_TileSurf.GetDC
    Call BMUtil.Blt(DC)
    Call DD_TileSurf.ReleaseDC(DC)


This makes DD_Tilesurf from DDSD_Tile, then it sets DC (our variable), to the DC of the the new surface.
After this it uses the dlls Blt command to put the tiles on the surface, then release the DC so it can be used.


Code:
DD_TileSurf.SetColorKey DDCKEY_SRCBLT, Key


this is the standard transparency key.


Now you need to go back and add this for sprites, items, and NPCs

Then run BMUtil.exe that you downlaoded in that package.

find yoru graphics files, and convert them tot he extension fo your choice. Make sure you remember the key you type in.

Go back tot he client, change all the "47dn45" to "thekeyyoutypedintotheprogramhere" and change GFX_EXT in modConstants tot he extesnion you chose.

There, your done
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)