Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Optimizing Editor Loading
#1
Originally posted by grimsk8ter11

Difficulty: 1/5
Full copy and paste, but it does explain stuff, int he first one so you actually get it

EditorInit() - Replace the WHOLE sub with

Code:
Public Sub EditorInit()
'*********************************************************** *****
'* WHEN        WHO        WHAT
'* ----        ---        ----
'* 07/12/2005  Shannara   Added gfx constants.
'* 10/29/2005  Grim       Now loads from Tile surface
'*********************************************************** *****
Dim DC As Long

    SaveMap = Map
    InEditor = True
    frmMirage.picMapEditor.Visible = True
    With frmMirage.picBackSelect
        .Width = 7 * PIC_X
        .Height = 255 * PIC_Y
    End With
    DC = DD_TileSurf.GetDC
    Call BitBlt(frmMirage.picBackSelect.hdc, 0, 0, DDSD_Tile.lWidth, DDSD_Tile.lHeight, DC, 0, 0, vbSrcCopy)
    DD_TileSurf.ReleaseDC (DC)
End Sub

Well theres really nto much to explain, instead of opening another file to memory, it losds the editors images directly from the current surfaces using BitBlt to move them from the surface to the pic boxes.

ItemEditorInit() - Replace the whole sub
[code]
Public Sub ItemEditorInit()
'*********************************************************** *****
'* WHEN WHO WHAT
'* ---- --- ----
'* 07/12/2005 Shannara Added gfx constant.
'* 10/29/2005 Grim Now loads from Item surface
'*********************************************************** *****
Dim DC As Long

DC = DD_ItemSurf.GetDC
Call BitBlt(frmItemEditor.picItems.hdc, 0, 0, DDSD_Item.lWidth, DDSD_Item.lHeight, DC, 0, 0, vbSrcCopy)
DD_ItemSurf.ReleaseDC (DC)

frmItemEditor.txtName.Text = Trim(Item(EditorIndex).Name)
frmItemEditor.scrlPic.Value = Item(EditorIndex).Pic
frmItemEditor.cmbType.ListIndex = Item(EditorIndex).Type

If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex
Reply
#2
look at the npceditorinit sub again...way to screw it up xD.
can ya find the mistake? Tongue
Reply
#3
fixed because mis is a picky bum.

i was just testing him guys dont worry.
Reply
#4
What about if we are loading several tilesets.. will it copy into the mapeditor all the tilesets being used?
Reply
#5
No, it'll only do whatever the tileset is that you stipulate.

For the other tilesets like tileset(1) or whatever, just use that variable instead of

This is the original:
DC = DD_TileSurf.GetDC
Call BitBlt(frmMirage.picBackSelect.hdc, 0, 0, DDSD_Tile.lWidth, DDSD_Tile.lHeight, DC, 0, 0, vbSrcCopy)
DD_TileSurf.ReleaseDC (DC)

Your's Should Be like this (depending on how your multiple tilesets work):
DC = DD_TileSurf(0).GetDC
Call BitBlt(frmMirage.picBackSelect.hdc, 0, 0, DDSD_Tile.lWidth, DDSD_Tile.lHeight, DC, 0, 0, vbSrcCopy)
DD_TileSurf(0).ReleaseDC (DC)


or whatever, if you still don't understand check your modDirectX and look at how it utilizes the multiple tiles. Then, you want to do the same kind of thing for the "switch" (like when you change to tileset 2) only instead of doing it when the editor loads, just do it when you click or change option or whatever. Make sense?
Reply
#6
Ya comming back if I get trouble
Reply
#7
Dave Wrote:Why not, in the item/NPC editor, get the image directly from the DD surface and skip the picture box step all together.

because originally, when i wrote this, the image wouldnt show up if i got it directly.
Reply
#8
i know that xD, i did it when if rist posted this,a nd it didnt work, so i didnt post it, its like a 2 year old tut Tongue
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)