Difficulty: 2/5 = Easy
This is an extremely basic optimization. I meant to post this a long time ago, but never got around to it.
BitBlt in Mirage is a completely useless function. There is absolutely no need for it, especially since when it is used, it loads pictures that are already loaded into memory, again. Useless and hogs memory.
This was made for MSE Build 1, but will work on 3.0.x.
All Client Side.
Open frmItemEditor. Make the form a little longer and select and delete picItems. Select picPic, and set it's AutoRedraw property to 'True'. Resize the form back to the way it was (Height = 4695)
Open frmMirage. Inside of picBack, in the upper left corner, select picBackSelect and delete it. Select picBack and change it's AutoRedraw property to 'True'. Select picSelect and set it's AutoRedraw property to 'True'. Goto Code View.
Find:
Code:
Private Sub picBackSelect_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Call EditorChooseTile(Button, Shift, x, y)
End Sub
Replace with:
Code:
Private Sub picBack_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Call EditorChooseTile(Button, Shift, x, y)
End Sub
Find:
Code:
Private Sub picBackSelect_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Call EditorChooseTile(Button, Shift, x, y)
End Sub
Replace with:
Code:
Private Sub picBack_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Call EditorChooseTile(Button, Shift, x, y)
End Sub
Open frmNPCEditor. Make the form a little longer and select and delete picSprites. Select picSprite, and set it's AutoRedraw property to 'True'. Resize the form back to the way it was (Height = 9375)
Open modGameLogic.
Find:
Code:
Public Sub EditorInit()
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 07/12/2005 Shannara Added gfx constants.
'****************************************************************
SaveMap = Map
InEditor = True
frmMirage.picMapEditor.Visible = True
With frmMirage.picBackSelect
.Width = 7 * PIC_X
.Height = 255 * PIC_Y
.Picture = LoadPicture(App.Path + GFX_PATH + "tiles" + GFX_EXT)
End With
End Sub
Replace with:
Code:
Public Sub EditorInit()
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 06/01/2006 BigRed Changed BitBlt to DX7
'* 07/12/2005 Shannara Added gfx constants.
'****************************************************************
SaveMap = Map
InEditor = True
frmMirage.picMapEditor.Visible = True
frmMirage.scrlPicture.Max = Int(DDSD_Tile.lHeight / PIC_Y) - 7
With rec
.top = 0
.Bottom = frmMirage.picBack.Height
.Left = 0
.Right = frmMirage.picBack.Width
End With
If DD_TileSurf Is Nothing Then
Else
With rec_pos
If frmMirage.scrlPicture.Value = 0 Then
.top = 0
Else
.top = (frmMirage.scrlPicture.Value * PIC_Y) * 1
End If
.Left = 0
.Bottom = .top + (frmMirage.picBack.Height)
.Right = frmMirage.picBack.Width
End With
DD_TileSurf.BltToDC frmMirage.picBack.hdc, rec_pos, rec
frmMirage.picBack.Refresh
End If
End Sub
Find:
Code:
Public Sub EditorChooseTile(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 1 Then
EditorTileX = Int(x / PIC_X)
EditorTileY = Int(y / PIC_Y)
End If
Call BitBlt(frmMirage.picSelect.hdc, 0, 0, PIC_X, PIC_Y, frmMirage.picBackSelect.hdc, EditorTileX * PIC_X, EditorTileY * PIC_Y, SRCCOPY)
End Sub
Replace with:
Code:
Public Sub EditorChooseTile(Button As Integer, Shift As Integer, x As Single, y As Single)
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 06/01/2006 BigRed Changed BitBlt to DX7
'****************************************************************
If Button = 1 Then
EditorTileX = Int(x / PIC_X)
EditorTileY = Int(y / PIC_Y) + frmMirage.scrlPicture.Value
End If
With rec_pos
.top = EditorTileY * PIC_Y
.Bottom = .top + PIC_Y
.Left = EditorTileX * PIC_X
.Right = .Left + PIC_X
End With
With rec
.top = 0
.Bottom = PIC_Y
.Left = 0
.Right = PIC_X
End With
If DD_TileSurf Is Nothing Then
Else
DD_TileSurf.BltToDC frmMirage.picSelect.hdc, rec_pos, rec
End If
frmMirage.picSelect.Refresh
End Sub
Find:
Code:
Public Sub EditorTileScroll()
frmMirage.picBackSelect.top = (frmMirage.scrlPicture.Value * PIC_Y) * -1
End Sub
Replace with:
Code:
Public Sub EditorTileScroll()
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 06/01/2006 BigRed Changed BitBlt to DX7
'****************************************************************
With rec
.top = 0
.Bottom = frmMirage.picBack.Height
.Left = 0
.Right = frmMirage.picBack.Width
End With
If DD_TileSurf Is Nothing Then
Else
With rec_pos
If frmMirage.scrlPicture.Value = 0 Then
.top = 0
Else
.top = (frmMirage.scrlPicture.Value * PIC_Y) * 1
End If
.Left = 0
.Bottom = .top + (frmMirage.picBack.Height)
.Right = frmMirage.picBack.Width
End With
DD_TileSurf.BltToDC frmMirage.picBack.hdc, rec_pos, rec
frmMirage.picBack.Refresh
End If
End Sub
Find:
Code:
Public Sub ItemEditorBltItem()
Call BitBlt(frmItemEditor.picPic.hdc, 0, 0, PIC_X, PIC_Y, frmItemEditor.picItems.hdc, 0, frmItemEditor.scrlPic.Value * PIC_Y, SRCCOPY)
End Sub
Replace with:
Code:
Public Sub ItemEditorBltItem()
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 06/01/2006 BigRed Changed BitBlt to DX7
'****************************************************************
With rec
.top = frmItemEditor.scrlPic.Value * PIC_Y
.Bottom = .top + PIC_Y
.Left = 0
.Right = PIC_X
End With
With rec_pos
.top = 0
.Bottom = PIC_Y
.Left = 0
.Right = PIC_X
End With
If DD_ItemSurf Is Nothing Then
Else
DD_ItemSurf.BltToDC frmItemEditor.picPic.hdc, rec, rec_pos
End If
frmItemEditor.picPic.Refresh
End Sub
Find
Code:
Public Sub ItemEditorInit()
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 07/12/2005 Shannara Added gfx constant.
'****************************************************************
frmItemEditor.picItems.Picture = LoadPicture(App.Path & GFX_PATH & "items" & GFX_EXT)
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
Replace with:
Code:
Public Sub ItemEditorInit()
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 06/01/2006 BigRed Removed LoadPicture
'* 07/12/2005 Shannara Added gfx constant.
'****************************************************************
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
Find:
Code:
Public Sub NpcEditorInit()
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 07/12/2005 Shannara Added gfx constant.
'****************************************************************
frmNpcEditor.picSprites.Picture = LoadPicture(App.Path & GFX_PATH & "sprites" & GFX_EXT)
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
Replace with:
Code:
Public Sub NpcEditorInit()
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 06/01/2006 BigRed Removed LoadPicture
'* 07/12/2005 Shannara Added gfx constant.
'****************************************************************
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
Find:
Code:
Public Sub NpcEditorBltSprite()
Call BitBlt(frmNpcEditor.picSprite.hdc, 0, 0, PIC_X, PIC_Y, frmNpcEditor.picSprites.hdc, 3 * PIC_X, frmNpcEditor.scrlSprite.Value * PIC_Y, SRCCOPY)
End Sub
Replace with:
Code:
Public Sub NpcEditorBltSprite()
'****************************************************************
'* WHEN WHO WHAT
'* ---- --- ----
'* 06/01/2006 BigRed Changed BitBlt to DX7
'****************************************************************
With rec
.top = frmNpcEditor.scrlSprite.Value * PIC_Y
.Bottom = .top + PIC_Y
.Left = 3 * PIC_X
.Right = .Left + PIC_X
End With
With rec_pos
.top = 0
.Bottom = PIC_Y
.Left = 0
.Right = PIC_X
End With
If DD_SpriteSurf Is Nothing Then
Else
DD_SpriteSurf.BltToDC frmNpcEditor.picSprite.hdc, rec, rec_pos
End If
frmNpcEditor.picSprite.Refresh
End Sub
Done.