Print Page | Close Window

Adding Verrigans image system

Printed From: Mirage Source
Category: Tutorials
Forum Name: Submitted Tutorials
Forum Discription: Tutorial submissions for MSE are posted here, waiting for approval
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=115
Printed Date: 20 December 2006 at 6:03pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Adding Verrigans image system
Posted By: Sync
Subject: Adding Verrigans image system
Date Posted: 11 February 2006 at 2:11pm
Originally posted by grimsk8ter11

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://verrigan.net/modules.php?name=Downloads&d_op=getit&lid=13 - http://verrigan.net/modules.php?name=Downloads&d_op=geti t&lid=13

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

Dim DC As Long

Dim BMUtil As BitmapUtils

Set BMUtil = New BitmapUtils



Heres the code for the tiles:

   ' 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

   ' 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.


    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


    Call BMUtil.DecompressByteData

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


    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.


    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.


    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



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info