Print Page | Close Window

Optimizing Editor Loading

Printed From: Mirage Source
Category: Tutorials
Forum Name: Approved Tutorials
Forum Discription: All tutorials shown to actually work with MSE are moved here.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=44
Printed Date: 20 December 2006 at 6:01pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: Optimizing Editor Loading
Posted By: Sync
Subject: Optimizing Editor Loading
Date Posted: 07 February 2006 at 6:12pm
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

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

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

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





Replies:
Posted By: Sync
Date Posted: 07 February 2006 at 6:12pm
Approved




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