Mirage Source http://miragesource.net/forums/ |
|
Optimizing Editor Loading http://miragesource.net/forums/viewtopic.php?f=210&t=69 |
Page 1 of 1 |
Author: | grimsk8ter11 [ Thu Jun 01, 2006 9:58 pm ] |
Post subject: | Optimizing Editor Loading |
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_SHIELD) Then frmItemEditor.fraEquipment.Visible = True frmItemEditor.scrlDurability.Value = Item(EditorIndex).Data1 frmItemEditor.scrlStrength.Value = Item(EditorIndex).Data2 Else frmItemEditor.fraEquipment.Visible = False End If If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex <= ITEM_TYPE_POTIONSUBSP) Then frmItemEditor.fraVitals.Visible = True frmItemEditor.scrlVitalMod.Value = Item(EditorIndex).Data1 Else frmItemEditor.fraVitals.Visible = False End If If (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_SPELL) Then frmItemEditor.fraSpell.Visible = True frmItemEditor.scrlSpell.Value = Item(EditorIndex).Data1 Else frmItemEditor.fraSpell.Visible = False End If frmItemEditor.Show vbModal End Sub NpcEditorInit() - Replace the WHOLE sub with Code: Public Sub NpcEditorInit()
'*********************************************************** ***** '* WHEN WHO WHAT '* ---- --- ---- '* 07/12/2005 Shannara Added gfx constant. '* 10/29/2005 Grim Now loads from Sprite surface '*********************************************************** ***** Dim DC As Long DC = DD_SpriteSurf.GetDC Call BitBlt(frmNpcEditor.picSprites.hdc, 0, 0, DDSD_Sprite.lWidth, DDSD_Sprite.lHeight, DC, 0, 0, vbSrcCopy) DD_SpriteSurf.ReleaseDC (DC) frmNpcEditor.txtName.Text = Trim(Npc(EditorIndex).Name) frmNpcEditor.txtAttackSay.Text = Trim(Npc(EditorIndex).AttackSay) frmNpcEditor.scrlSprite.Value = Npc(EditorIndex).Sprite frmNpcEditor.txtSpawnSecs.Text = STR(Npc(EditorIndex).SpawnSecs) frmNpcEditor.cmbBehavior.ListIndex = Npc(EditorIndex).Behavior frmNpcEditor.scrlRange.Value = Npc(EditorIndex).Range frmNpcEditor.txtChance.Text = STR(Npc(EditorIndex).DropChance) frmNpcEditor.scrlNum.Value = Npc(EditorIndex).DropItem frmNpcEditor.scrlValue.Value = Npc(EditorIndex).DropItemValue frmNpcEditor.scrlSTR.Value = Npc(EditorIndex).STR frmNpcEditor.scrlDEF.Value = Npc(EditorIndex).DEF frmNpcEditor.scrlSPEED.Value = Npc(EditorIndex).SPEED frmNpcEditor.scrlMAGI.Value = Npc(EditorIndex).MAGI frmNpcEditor.Show vbModal End Sub |
Author: | Misunderstood [ Fri Jun 02, 2006 12:24 am ] |
Post subject: | |
look at the npceditorinit sub again...way to screw it up xD. can ya find the mistake? |
Author: | grimsk8ter11 [ Fri Jun 02, 2006 12:40 am ] |
Post subject: | |
fixed because mis is a picky bum. i was just testing him guys dont worry. |
Author: | Krloz [ Sun Sep 03, 2006 1:48 am ] |
Post subject: | |
What about if we are loading several tilesets.. will it copy into the mapeditor all the tilesets being used? |
Author: | Obsidian [ Sun Sep 03, 2006 5:25 pm ] |
Post subject: | |
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? |
Author: | Krloz [ Mon Sep 04, 2006 12:06 am ] |
Post subject: | |
Ya comming back if I get trouble |
Author: | Lea [ Mon Sep 04, 2006 11:54 am ] |
Post subject: | |
Why not, in the item/NPC editor, get the image directly from the DD surface and skip the picture box step all together. |
Author: | grimsk8ter11 [ Mon Sep 04, 2006 2:15 pm ] |
Post subject: | |
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. |
Author: | Lea [ Mon Sep 04, 2006 2:41 pm ] |
Post subject: | |
Well, you would need to remove the blit from the Editorinit function all together, then modify the Blit in the frm___Editor to show it from the surface instead of the picturebox, easy peasy. |
Author: | grimsk8ter11 [ Mon Sep 04, 2006 2:44 pm ] |
Post subject: | |
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 |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |