02-06-2006, 04:37 AM
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:Replace with:Find: Replace with:
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:Replace with:Find:Replace with:Find: Replace with:Find:Replace with: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_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex
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
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
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
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
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
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
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
Code:
Public Sub EditorTileScroll()
frmMirage.picBackSelect.top = (frmMirage.scrlPicture.Value * PIC_Y) * -1
End Sub
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
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
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
'****************************************************************
'* 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_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex