Mirage Source

Free ORPG making software.
It is currently Fri Apr 19, 2024 8:25 am

All times are UTC




Post new topic Reply to topic  [ 68 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Verrigans Image System
PostPosted: Thu Jun 01, 2006 9:07 pm 
Offline
Pro

Joined: Mon May 29, 2006 2:58 pm
Posts: 370
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


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 09, 2006 4:11 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Source has been provided for this... I believe the link is http://www.verrigan.net/bitmaputils/VWBitmapUtils.zip


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 5:03 pm 
Offline
Persistant Poster
User avatar

Joined: Thu Aug 17, 2006 5:27 pm
Posts: 866
Location: United Kingdom
Woah nice!

How hard is it for people to break into your graphics using this method?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 5:19 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
It's easy if you give them your password... or store the password as plain text in your exe.. (public const imgpw = "this is the image file password")... But if you are slightly more careful, it would be a bit more difficult.. and if you have it randomly change the password, and reencrypt the data based on a random encryption method, you'd do even better to keep your graphics out of the hands of malicious users. :)

Just don't accidentally release your BMPs with the converted graphics files, and you should be fairly safe. :)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 7:41 pm 
Offline
Pro

Joined: Mon May 29, 2006 2:58 pm
Posts: 370
Verrigan wrote:
Just don't accidentally release your BMPs with the converted graphics files, and you should be fairly safe. :)


*cough* mis *cough*

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 24, 2006 8:39 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
I'm pretty sure that was me, actually..


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 25, 2006 12:16 am 
Offline
Pro

Joined: Mon May 29, 2006 1:40 pm
Posts: 430
Ha! it wasnt me!


Top
 Profile  
 
 Post subject: hi
PostPosted: Sat Aug 26, 2006 10:19 pm 
Offline
Newbie

Joined: Sat Aug 26, 2006 9:24 pm
Posts: 3
hi, i followed the tutorial, and my arrow graphics display, and in my decryptgfx sub i have it bmu.blt t the right picboxes, but in the pic boxes there not there.. do i have to put something in the arrow editor and item editor and the other editor for that matter ? sorry if this seems nubbish, but i am a nub when it comes to blt lol.

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 26, 2006 10:23 pm 
Offline
Pro

Joined: Mon May 29, 2006 1:40 pm
Posts: 430
Maybe if you show part of the code(dont show your key :) ) we can see whats wrong.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 26, 2006 10:28 pm 
Offline
Newbie

Joined: Sat Aug 26, 2006 9:24 pm
Posts: 3
[Sub DecryptGfx()
Dim BMU as BitmapUtils
Dim strFileName as String

'Initialize the BitmapUtils object.
Set BMU = New BitmapUtils

strFileName = App.Path & "/gfx/arrows.gfx"

'Load the bytes from the file into memory.
BMU.LoadByteData (strFileName)

'Decrypt the byte data.
BMU.DecryptByteData ("test")

'Decompress the byte data.
BMU.DecompressByteData

'Blt the image from memory to the Picture Box.
BMU.Blt (frmEditItem.picBow.hDC)
BMU.Blt (frmEditArrows.picArrows.hDC)
End Sub[/quote]

and in the item editor and arrow editor ini subs i didnt know what to do about the frm loadpicture line. so i deleted that. the background in the boxes currently is a lighter black color. :S


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 26, 2006 10:51 pm 
Offline
Pro

Joined: Mon May 29, 2006 1:40 pm
Posts: 430
You're blting it to the pictureboxes before the window is shown, so they will be cleared when the form is shown. You're gonna need to blt it when the form loads like before.

There still might be other problems with it, I dont remember exactly how it works. I havent looked at it in a while.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 26, 2006 11:00 pm 
Offline
Newbie

Joined: Sat Aug 26, 2006 9:24 pm
Posts: 3
where would you suggest i put the blt at ?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 26, 2006 11:08 pm 
Offline
Pro

Joined: Mon May 29, 2006 1:40 pm
Posts: 430
when you load the forms. In the form_load code, or in the init code. Where it is originaly, only you put the new blt code instead of the old blt code.

If you are storing the arrows in a surface, you can load the file to the surface(only once where its normally done), then use surface.blttodc to blt to the picturebox's dc.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 01, 2006 6:22 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
Could someone please edit the first post in this thread, and replace the link with http://www.verrigan.net/bitmaputils/VWBitmapUtils.zip ? I'm getting errors of people looking for the file, and not getting it because I got rid of phpnuke. :P


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 01, 2006 8:48 pm 
Offline
Community Leader
User avatar

Joined: Sun May 28, 2006 10:29 pm
Posts: 1762
Location: Salt Lake City, UT, USA
Google Talk: Darunada@gmail.com
Edited, enjoy.

_________________
I'm on Facebook! Google Plus LinkedIn My Youtube Channel Send me an email Call me with Skype Check me out on Bitbucket Yup, I'm an EVE Online player!
Why not try my app, ColorEye, on your Android devlce?
Do you like social gaming? Fight it out in Battle Juice!

I am a professional software developer in Salt Lake City, UT.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 20, 2006 9:40 pm 
Offline
Banned
User avatar

Joined: Mon Jun 05, 2006 9:22 pm
Posts: 394
Location: USA
Would this work if you've changed from BMP graphics to PNG graphics? Just wondering.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 22, 2006 2:10 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
No - (BitmapUtils)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 22, 2006 9:07 pm 
Offline
Banned
User avatar

Joined: Mon Jun 05, 2006 9:22 pm
Posts: 394
Location: USA
Okay, thanks anyways. =/


Top
 Profile  
 
PostPosted: Tue Mar 06, 2007 11:40 pm 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
grimsk8ter11 wrote:
Download this:
http://www.verrigan.net/bitmaputils/VWBitmapUtils.zip

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


And do what?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 07, 2007 3:07 am 
Offline
Pro

Joined: Mon May 29, 2006 2:58 pm
Posts: 370
zel you've been around forever, you should know this shit.

you add it as a reference. self explanatory instead of staring at the little check boxes =)

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 07, 2007 7:45 am 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
I see it now, I was loading the group project file and it wouldn't compile. :P


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 07, 2007 8:45 am 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
I get an invalid procedure call or argument error.

Code:
Set DD_SpriteSurf = DD.CreateSurface(DDSD_Sprite)


Here is my code in my init sub:

Code:
' Init sprite ddsd type and load the bitmap
    Call BMUtil.LoadByteData(FileName & "sprites" & GFX_EXT)
    Call BMUtil.DecryptByteData("47dn45")
    Call BMUtil.DecompressByteData
    With DDSD_Sprite
        .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_SpriteSurf = DD.CreateSurface(DDSD_Sprite)
    DC = DD_SpriteSurf.GetDC
    Call BMUtil.Blt(DC)
    Call DD_SpriteSurf.ReleaseDC(DC)
    DD_SpriteSurf.SetColorKey DDCKEY_SRCBLT, Key
' 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
' Init item ddsd type and load the bitmap
    Call BMUtil.LoadByteData(FileName & "items" & GFX_EXT)
    Call BMUtil.DecryptByteData("47dn45")
    Call BMUtil.DecompressByteData
    With DDSD_Item
        .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_ItemSurf = DD.CreateSurface(DDSD_Item)
    DC = DD_ItemSurf.GetDC
    Call BMUtil.Blt(DC)
    Call DD_ItemSurf.ReleaseDC(DC)
    DD_ItemSurf.SetColorKey DDCKEY_SRCBLT, Key


I added the reference, and the file extension is correct (That wouldn't produce this error though anyway).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 08, 2007 7:08 pm 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
What are the values of the ImageWidth and ImageHeight?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 2:44 am 
Offline
Pro
User avatar

Joined: Wed Sep 20, 2006 1:06 pm
Posts: 368
Location: UK
Google Talk: steve.bluez@googlemail.com
When I hover the mouse over, they result as 0


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 6:39 am 
Offline
Knowledgeable
User avatar

Joined: Sun May 28, 2006 10:07 pm
Posts: 327
Location: Washington
I believe that is what the problem is.. You're trying to create a surface with no height/width..

Check to make sure that the password you are using to decrypt your graphics files is correct.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 68 posts ]  Go to page 1, 2, 3  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group