VERSION 5.00
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form WallDecorationGraphicInfoEditor 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Wall Decoration Graphic Info Editor"
   ClientHeight    =   9825
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   11265
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   655
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   751
   StartUpPosition =   3  'Windows Default
   Begin VB.PictureBox Graphic 
      AutoRedraw      =   -1  'True
      Height          =   4080
      Left            =   2160
      ScaleHeight     =   268
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   444
      TabIndex        =   19
      Top             =   480
      Width           =   6720
      Begin VB.Shape GSelectBox 
         BackColor       =   &H000000FF&
         BorderColor     =   &H0000FFFF&
         BorderWidth     =   2
         FillColor       =   &H00FFFFFF&
         Height          =   120
         Left            =   840
         Top             =   240
         Width           =   120
      End
      Begin VB.Shape GLocRect 
         BorderColor     =   &H000000FF&
         BorderWidth     =   2
         Height          =   255
         Left            =   240
         Top             =   240
         Width           =   255
      End
      Begin MSForms.Image GLocPointer 
         Height          =   120
         Left            =   600
         Top             =   240
         Width           =   120
         BorderColor     =   65535
         BackColor       =   255
         BorderStyle     =   0
         Size            =   "212;212"
      End
   End
   Begin VB.TextBox X1Coord 
      Height          =   285
      Left            =   8520
      TabIndex        =   5
      Top             =   5280
      Width           =   495
   End
   Begin VB.TextBox Y1Coord 
      Height          =   285
      Left            =   9480
      TabIndex        =   4
      Top             =   5280
      Width           =   495
   End
   Begin VB.TextBox X2Coord 
      Height          =   285
      Left            =   8520
      TabIndex        =   3
      Top             =   5640
      Width           =   495
   End
   Begin VB.TextBox Y2Coord 
      Height          =   285
      Left            =   9480
      TabIndex        =   2
      Top             =   5640
      Width           =   495
   End
   Begin VB.TextBox GWidth 
      Height          =   285
      Left            =   8520
      TabIndex        =   1
      Top             =   6000
      Width           =   1095
   End
   Begin VB.TextBox GHeight 
      Height          =   285
      Left            =   8520
      TabIndex        =   0
      Top             =   6360
      Width           =   1095
   End
   Begin MSForms.CommandButton PaletteInfo 
      Default         =   -1  'True
      Height          =   375
      Left            =   8400
      TabIndex        =   18
      Top             =   9360
      Width           =   1335
      Caption         =   "Edit Palette"
      Size            =   "2355;661"
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.ListBox CGDecorationList 
      Height          =   4365
      Left            =   2520
      TabIndex        =   17
      Top             =   4920
      Width           =   5160
      ScrollBars      =   3
      DisplayStyle    =   2
      Size            =   "9102;7699"
      ColumnCount     =   2
      cColumnInfo     =   1
      MatchEntry      =   0
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      Object.Width           =   "987"
   End
   Begin MSForms.CommandButton Ok 
      Height          =   375
      Left            =   120
      TabIndex        =   7
      Top             =   9360
      Width           =   1335
      Caption         =   "Ok"
      Size            =   "2355;661"
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton Cancel 
      Cancel          =   -1  'True
      Height          =   375
      Left            =   9840
      TabIndex        =   6
      Top             =   9360
      Width           =   1335
      Caption         =   "Cancel"
      Size            =   "2355;661"
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "width/2:"
      Height          =   255
      Index           =   6
      Left            =   7440
      TabIndex        =   16
      Top             =   6000
      Width           =   975
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "height:"
      Height          =   255
      Index           =   7
      Left            =   7440
      TabIndex        =   15
      Top             =   6360
      Width           =   975
   End
   Begin MSForms.ListBox CGGroupList 
      Height          =   1635
      Left            =   120
      TabIndex        =   14
      Top             =   7635
      Width           =   2280
      ScrollBars      =   3
      DisplayStyle    =   2
      Size            =   "4022;2884"
      ColumnCount     =   2
      cColumnInfo     =   1
      MatchEntry      =   0
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      Object.Width           =   "987"
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "Y1:"
      Height          =   255
      Index           =   3
      Left            =   9120
      TabIndex        =   13
      Top             =   5280
      Width           =   255
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "Coordinates:"
      Height          =   255
      Index           =   0
      Left            =   8400
      TabIndex        =   12
      Top             =   5040
      Width           =   1095
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "X1:"
      Height          =   255
      Index           =   2
      Left            =   8160
      TabIndex        =   11
      Top             =   5280
      Width           =   255
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "X2:"
      Height          =   255
      Index           =   4
      Left            =   8160
      TabIndex        =   10
      Top             =   5640
      Width           =   255
   End
   Begin VB.Label ST 
      Alignment       =   1  'Right Justify
      Caption         =   "Y2:"
      Height          =   255
      Index           =   5
      Left            =   9120
      TabIndex        =   9
      Top             =   5640
      Width           =   255
   End
   Begin MSForms.ListBox CGLocationList 
      Height          =   2610
      Left            =   120
      TabIndex        =   8
      Top             =   4920
      Width           =   2280
      ScrollBars      =   3
      DisplayStyle    =   2
      Size            =   "4022;4604"
      ColumnCount     =   2
      cColumnInfo     =   1
      MatchEntry      =   0
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      Object.Width           =   "987"
   End
End
Attribute VB_Name = "WallDecorationGraphicInfoEditor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private walldecorationgroups(8, 13) As New decorationinfo
Private walldecorationnumbers(60) As Byte
Public selectedgroup As Integer
Public selectedlocation As Integer
Public selecteddecoration As Long
'Public selectedsublocation As Integer
Public subchange As Boolean
Public subclickchange As Boolean
Public selectedimage As Integer
Public tracking As Boolean
Public savedx As Integer
Public savedy As Integer
Public savedw As Integer
Public savedh As Integer

Public Function returnCustomPaletteEditor(window As CustomPaletteEditor)
    Dim i As Integer
    
    For i = 1 To 16
        graphics.f558.setd2walldecorationpalette i, window.getd2palette(i)
        graphics.f558.setd3walldecorationpalette i, window.getd3palette(i)
    Next
    update
End Function

Public Function init()
    Dim i As Integer
    
    'graphics.resetmodifiedcolorarray
    'CeilingGraphic.Picture = graphics.loadgraphic(77, 0)
    'Floorgraphic.Picture = graphics.loadgraphic(76, 0)
    '360 to 445
    '60 and start at 121, 123, 125, etc (odds)
    
    
    CGGroupList.Clear
    CGGroupList.AddItem
    CGGroupList.List(0, 0) = "00"
    CGGroupList.List(0, 1) = "Group 0"
    CGGroupList.AddItem
    CGGroupList.List(1, 0) = "01"
    CGGroupList.List(1, 1) = "Group 1"
    CGGroupList.AddItem
    CGGroupList.List(2, 0) = "02"
    CGGroupList.List(2, 1) = "Group 2"
    CGGroupList.AddItem
    CGGroupList.List(3, 0) = "03"
    CGGroupList.List(3, 1) = "Group 3"
    CGGroupList.AddItem
    CGGroupList.List(4, 0) = "04"
    CGGroupList.List(4, 1) = "Group 4"
    CGGroupList.AddItem
    CGGroupList.List(5, 0) = "05"
    CGGroupList.List(5, 1) = "Group 5"
    CGGroupList.AddItem
    CGGroupList.List(6, 0) = "06"
    CGGroupList.List(6, 1) = "Group 6"
    CGGroupList.AddItem
    CGGroupList.List(7, 0) = "07"
    CGGroupList.List(7, 1) = "Group 7"
    
    
    CGLocationList.Clear
    CGLocationList.AddItem
    CGLocationList.List(0, 0) = "00"
    CGLocationList.List(0, 1) = "D3 Left Hall"
    CGLocationList.AddItem
    CGLocationList.List(1, 0) = "01"
    CGLocationList.List(1, 1) = "D3 Right Hall"
    CGLocationList.AddItem
    CGLocationList.List(2, 0) = "02"
    CGLocationList.List(2, 1) = "D3 Left Wall"
    CGLocationList.AddItem
    CGLocationList.List(3, 0) = "03"
    CGLocationList.List(3, 1) = "D3 Center Wall"
    CGLocationList.AddItem
    CGLocationList.List(4, 0) = "04"
    CGLocationList.List(4, 1) = "D3 Right Wall"
    CGLocationList.AddItem
    CGLocationList.List(5, 0) = "05"
    CGLocationList.List(5, 1) = "D2 Left Hall"
    CGLocationList.AddItem
    CGLocationList.List(6, 0) = "06"
    CGLocationList.List(6, 1) = "D2 Right Hall"
    CGLocationList.AddItem
    CGLocationList.List(7, 0) = "07"
    CGLocationList.List(7, 1) = "D2 Left Wall"
    CGLocationList.AddItem
    CGLocationList.List(8, 0) = "08"
    CGLocationList.List(8, 1) = "D2 Center Wall"
    CGLocationList.AddItem
    CGLocationList.List(9, 0) = "09"
    CGLocationList.List(9, 1) = "D2 Right Wall"
    CGLocationList.AddItem
    CGLocationList.List(10, 0) = "10"
    CGLocationList.List(10, 1) = "D1 Left Hall"
    CGLocationList.AddItem
    CGLocationList.List(11, 0) = "11"
    CGLocationList.List(11, 1) = "D1 Right Hall"
    CGLocationList.AddItem
    CGLocationList.List(12, 0) = "12"
    CGLocationList.List(12, 1) = "D1 Center Wall"
    
    'CGSubLocationList.Clear
    'CGSubLocationList.AddItem
    'CGSubLocationList.List(0, 0) = "00"
    'CGSubLocationList.List(0, 1) = "Far Left"
    'CGSubLocationList.AddItem
    'CGSubLocationList.List(1, 0) = "01"
    'CGSubLocationList.List(1, 1) = "Far Right"
    'CGSubLocationList.AddItem
    'CGSubLocationList.List(2, 0) = "02"
    'CGSubLocationList.List(2, 1) = "Near Right"
    'CGSubLocationList.AddItem
    'CGSubLocationList.List(3, 0) = "03"
    'CGSubLocationList.List(3, 1) = "Near Left"
    'CGSubLocationList.AddItem
    'CGSubLocationList.List(4, 0) = "04"
    'CGSubLocationList.List(4, 1) = "Center"
    
    For i = 1 To 8
        For j = 1 To 13
            walldecorationgroups(i, j).x1 = graphics.f558.walldecorationinfo(i, j).x1
            walldecorationgroups(i, j).x2 = graphics.f558.walldecorationinfo(i, j).x2
            walldecorationgroups(i, j).y1 = graphics.f558.walldecorationinfo(i, j).y1
            walldecorationgroups(i, j).y2 = graphics.f558.walldecorationinfo(i, j).y2
            walldecorationgroups(i, j).width = graphics.f558.walldecorationinfo(i, j).width
            walldecorationgroups(i, j).height = graphics.f558.walldecorationinfo(i, j).height
        Next
    Next
    
    For i = 1 To 60
        walldecorationnumbers(i) = graphics.f558.walldecorationnumber(i)
    Next
    
    
    CGDecorationList.Clear
    For i = 1 To 60
        CGDecorationList.AddItem
        CGDecorationList.List(i - 1, 0) = zerostr(i - 1, 2)
        CGDecorationList.List(i - 1, 1) = mapfile.getname(120 + i * 2)
    Next
    CGDecorationList.ListIndex = 0
    
    subchange = True
    selectgroup (1)
    selectlocation (1)
    selectdecoration (1)
    'selectsublocation (1)
    subchange = False
    update
End Function

Private Sub Cancel_Click()
    unload Me
End Sub

Private Sub CGDecorationList_Click()

    If subchange = True Then
        Exit Sub
    End If
    'left3 front3 left2 front2 left1 front1
    subchange = True
    selectdecoration (CGDecorationList.ListIndex + 1)
    subchange = False
End Sub

Private Sub CGGroupList_Click()
    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    selectgroup (CGGroupList.ListIndex + 1)
    walldecorationnumbers(CGDecorationList.ListIndex + 1) = CGGroupList.ListIndex
    subchange = False
End Sub
Private Sub CGLocationList_Click()

    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    selectlocation (CGLocationList.ListIndex + 1)
    subchange = False
End Sub

'Private Sub CGSubLocationList_Click()
'
'    If subchange = True Then
'        Exit Sub
'    End If
'    subchange = True
'    selectsublocation (CGSubLocationList.ListIndex + 1)
'    subchange = False
'End Sub



Private Sub GLocPointer_MouseDown(walldecoration As Integer, Shift As Integer, X As Single, Y As Single)
    
    If walldecoration = 1 Then
    tracking = True
    savedx = walldecorationgroups(selectedgroup, selectedlocation).x1
    savedy = walldecorationgroups(selectedgroup, selectedlocation).y1
    savedw = walldecorationgroups(selectedgroup, selectedlocation).x2 - walldecorationgroups(selectedgroup, selectedlocation).x1
    savedh = walldecorationgroups(selectedgroup, selectedlocation).y2 - walldecorationgroups(selectedgroup, selectedlocation).y1
    End If
    
End Sub

'Private Sub ImageA_MouseDown(walldecoration As Integer, Shift As Integer, X As Single, Y As Single)
'
'    If walldecoration = 2 Then
'        X = X * 2
'        X = X / 3
'        Y = Y * 2
'        Y = Y / 3
'
'        If selectedlocation = 2 Or selectedlocation = 5 Or selectedlocation = 8 Or selectedlocation = 10 Then
'            X = X + 100
'        End If
'        If selectedlocation = 3 Or selectedlocation = 6 Or selectedlocation = 9 Or selectedlocation = 11 Then
'            X = X - 100
'        End If
'
'        If X > 255 Then
'            X = 255
'        End If
'        If X < 0 Then
'            X = 0
'        End If
'        If Y > 255 Then
'            Y = 255
'        End If
'        If Y < 0 Then
'            Y = 0
'        End If
'
'
'
'        walldecorationgroups(selectedgroup, selectedlocation).setloc selectedsublocation, 1, X
'        walldecorationgroups(selectedgroup, selectedlocation).setloc selectedsublocation, 2, Y
'
'        update
'        'MsgBox "x=" + Str(X) + " y=" + Str(Y)
'    End If
'
'End Sub



Private Sub GLocPointer_MouseMove(walldecoration As Integer, Shift As Integer, X As Single, Y As Single)
    Dim x2, y2 As Single
    If tracking = True Then
        subclickchange = True
        x2 = X * 4
        x2 = x2 / 3
        y2 = Y * 4
        y2 = y2 / 3
        x2 = x2 - 4
        y2 = y2 - 4
        x2 = x2 / 2
        y2 = y2 / 2
        
        x2 = x2 + savedx
        y2 = y2 + savedy
        If x2 < 0 Then
            x2 = 0
        End If
        If x2 + savedw > 255 Then
            x2 = 255 - savedw
        End If
        
        If y2 < 0 Then
            y2 = 0
        End If
        If y2 + savedh > 255 Then
            y2 = 255 - savedh
        End If
        
        walldecorationgroups(selectedgroup, selectedlocation).x1 = x2
        walldecorationgroups(selectedgroup, selectedlocation).y1 = y2
        walldecorationgroups(selectedgroup, selectedlocation).x2 = walldecorationgroups(selectedgroup, selectedlocation).x1 + savedw
        walldecorationgroups(selectedgroup, selectedlocation).y2 = walldecorationgroups(selectedgroup, selectedlocation).y1 + savedh
        'XCoord.Text = Str(x2)
        'YCoord.Text = Str(y2)
        
        update
        subclickchange = False
    End If
    
End Sub


Private Sub GLocPointer_MouseUp(walldecoration As Integer, Shift As Integer, X As Single, Y As Single)
    tracking = False
    'MsgBox "aasdf"
    update
End Sub

Private Sub Ok_Click()
    Dim i, j As Integer
    
    For i = 1 To 8
        For j = 1 To 13
            graphics.f558.walldecorationinfo(i, j).x1 = walldecorationgroups(i, j).x1
            graphics.f558.walldecorationinfo(i, j).x2 = walldecorationgroups(i, j).x2
            graphics.f558.walldecorationinfo(i, j).y1 = walldecorationgroups(i, j).y1
            graphics.f558.walldecorationinfo(i, j).y2 = walldecorationgroups(i, j).y2
            graphics.f558.walldecorationinfo(i, j).width = walldecorationgroups(i, j).width
            graphics.f558.walldecorationinfo(i, j).height = walldecorationgroups(i, j).height
        Next
    Next
    For i = 1 To 60
        graphics.f558.setwalldecorationnumber i, walldecorationnumbers(i)
    Next
    App.graphics.f558.update
    unload Me
    
End Sub
Public Sub selectgroup(ByVal num As Integer)
    selectedgroup = num
    CGGroupList.ListIndex = num - 1
    X1Coord.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).x1)
    X2Coord.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).x2)
    Y1Coord.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).y1)
    Y2Coord.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).y2)
    GWidth.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).width)
    GHeight.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).height)
    update
End Sub

Public Sub selectlocation(ByVal num As Integer)
    selectedlocation = num
    CGLocationList.ListIndex = num - 1
    X1Coord.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).x1)
    X2Coord.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).x2)
    Y1Coord.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).y1)
    Y2Coord.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).y2)
    GWidth.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).width)
    GHeight.Text = Str(walldecorationgroups(selectedgroup, selectedlocation).height)
    
    Dim offset As Integer
    
    'If selectedlocation = 1 Or selectedlocation = 2 Or selectedlocation = 3 Or selectedlocation = 4 Or selectedlocation = 5 Then 'd3
    '    For i = 1 To 16
    '        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d3walldecorationpalette(i) / 10) + 1)
    '    Next
    '    offset = 2
    'ElseIf selectedlocation = 6 Or selectedlocation = 7 Or selectedlocation = 8 Or selectedlocation = 9 Or selectedlocation = 10 Then 'd2
    '    For i = 1 To 16
    '        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d2walldecorationpalette(i) / 10) + 1)
    '    Next
    '    offset = 4
    'Else 'd1
    '    graphics.resetmodifiedcolorarray
    '    offset = 0
    'End If
    
    'WallDecorationGraphicLeft = graphics.loadgraphic(selectedimage, offset)
    'WallDecorationGraphicCenter = graphics.loadgraphic(selectedimage + 1, offset)
    'WallDecorationGraphicRight = graphics.loadgraphic(selectedimage, offset + 1)
    
    update
End Sub

Public Sub selectdecoration(ByVal num As Integer)
    selecteddecoration = num
    CGDecorationList.ListIndex = num - 1
    
    'selectedimage = 122 + ((selecteddecoration - 1) * 2)
    
    'Dim i As Integer
    'Dim j As Integer
    
'    graphics.resetmodifiedcolorarray
'
'    WallDecorationGraphicLeft = graphics.loadgraphic(selectedimage, 0)
'    WallDecorationGraphicCenter = graphics.loadgraphic(selectedimage + 1, 0)
'    WallDecorationGraphicRight = graphics.loadgraphic(selectedimage, 1)

    'Dim offset As Integer
    
    'If selectedlocation = 1 Or selectedlocation = 2 Or selectedlocation = 3 Or selectedlocation = 4 Or selectedlocation = 5 Then 'd3
    '    For i = 1 To 16
    '        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d3walldecorationpalette(i) / 10) + 1)
    '    Next
    '    offset = 2
    'ElseIf selectedlocation = 6 Or selectedlocation = 7 Or selectedlocation = 8 Or selectedlocation = 9 Or selectedlocation = 10 Then 'd2
    '    For i = 1 To 16
    '        graphics.setmodifiedcolor i, graphics.color((graphics.f558.d2walldecorationpalette(i) / 10) + 1)
    '    Next
    '    offset = 4
    'Else 'd1
    '    graphics.resetmodifiedcolorarray
    '    offset = 0
    'End If
    
    'WallDecorationGraphicLeft = graphics.loadgraphic(selectedimage, offset)
    'WallDecorationGraphicCenter = graphics.loadgraphic(selectedimage + 1, offset)
    'WallDecorationGraphicRight = graphics.loadgraphic(selectedimage, offset + 1)
    
    selectgroup (walldecorationnumbers(selecteddecoration) + 1)
    update
End Sub

'Public Sub selectsublocation(ByVal num As Integer)
'    selectedsublocation = num
'    CGSubLocationList.ListIndex = num - 1
'    update
'End Sub

Public Sub update()

    Dim x1, x2, y1, y2 As Integer
    
    Dim i As Integer
    
    'draw ceiling/floor
    graphics.curPalette = graphics.gPALETTE_MAIN
    graphics.fill Graphic.hdc, 0, 0, Graphic.width, Graphic.height, vbBlack
    graphics.stretchbmpby Graphic.hdc, 76, 0, 0, 0, 0, 200, 200
    graphics.stretchbmpby Graphic.hdc, 75, 0, 132, 0, 0, 200, 200
    If selectedlocation = 1 Or selectedlocation = 2 Or selectedlocation = 6 Or selectedlocation = 7 Or selectedlocation = 11 Or selectedlocation = 12 Then
        'draw the hallway
        graphics.drawgrect Graphic.hdc, 107, -1, 10, 200 'far back left
        graphics.drawgrect Graphic.hdc, 108, -1, 10, 200 'far back right
        graphics.drawgrect Graphic.hdc, 110, -1, 10, 200 'mid left
        graphics.drawgrect Graphic.hdc, 111, -1, 10, 200 'mid right
        graphics.drawgrect Graphic.hdc, 113, -1, 10, 200 'near left
        graphics.drawgrect Graphic.hdc, 114, -1, 10, 200 'near right
        graphics.drawgrect Graphic.hdc, 116, -1, 10, 200 'immidiate left
        graphics.drawgrect Graphic.hdc, 117, -1, 10, 200 'immidiate right
        
    ElseIf selectedlocation = 3 Or selectedlocation = 4 Or selectedlocation = 5 Then
        'draw d3
        graphics.drawgrect Graphic.hdc, 107, -1, 10, 200
        graphics.drawgrect Graphic.hdc, 108, -1, 10, 200
        graphics.drawgrect Graphic.hdc, 106, -1, 10, 200

    ElseIf selectedlocation = 8 Or selectedlocation = 9 Or selectedlocation = 10 Then
        'draw d2
        graphics.drawgrect Graphic.hdc, 110, -1, 10, 200
        graphics.drawgrect Graphic.hdc, 111, -1, 10, 200
        graphics.drawgrect Graphic.hdc, 109, -1, 10, 200
    Else
        'draw d1
        graphics.drawgrect Graphic.hdc, 113, -1, 10, 200
        graphics.drawgrect Graphic.hdc, 114, -1, 10, 200
        graphics.drawgrect Graphic.hdc, 112, -1, 10, 200
    End If
    
    'modify the palette
    
    graphics.copypalette graphics.gPALETTE_MAIN, graphics.gPALETTE_CUSTOM
    
    If selectedlocation <= 5 Then
        For i = 0 To 15
            graphics.setpalette graphics.gPALETTE_CUSTOM, i, _
                graphics.getpalette(graphics.gPALETTE_MAIN, _
                    (graphics.f558.d3walldecorationpalette(i + 1) / 10))
        Next
    
    ElseIf selectedlocation <= 10 Then
        For i = 0 To 15
            graphics.setpalette graphics.gPALETTE_CUSTOM, i, _
                graphics.getpalette(graphics.gPALETTE_MAIN, _
                    (graphics.f558.d2walldecorationpalette(i + 1) / 10))
        Next
        
    End If
    'if neither case, just use the main palette
    graphics.curPalette = graphics.gPALETTE_CUSTOM
    
    '1,2 = hallway
    '3,4,5 = d3
    '6,7 = hallway
    '8,9,10 = d2
    '11,12 = hallway
    '13 = d1
    
    'If selectedlocation = 1 Or selectedlocation = 6 Or selectedlocation = 10 Then
    '    Me.WallDecorationGraphicLeft.Visible = True
    '    Me.WallDecorationGraphicRight.Visible = False
    '    Me.WallDecorationGraphicCenter.Visible = False
    'ElseIf selectedlocation = 2 Or selectedlocation = 7 Or selectedlocation = 11 Then
    '    Me.WallDecorationGraphicLeft.Visible = False
    '    Me.WallDecorationGraphicRight.Visible = True
    '    Me.WallDecorationGraphicCenter.Visible = False
    'Else
    '    Me.WallDecorationGraphicLeft.Visible = False
    '    Me.WallDecorationGraphicRight.Visible = False
    '    Me.WallDecorationGraphicCenter.Visible = True
    'End If
    '
    'If (selectedlocation <= 2) Or (selectedlocation >= 6 And selectedlocation <= 7) Or (selectedlocation >= 11 And selectedlocation <= 12) Then
    '    'hallway
    '    WallHall.Visible = True
    '    WallNear.Visible = False
    '    WallMedium.Visible = False
    '    WallFar.Visible = False
    'Else
    '    WallHall.Visible = False
    '    If selectedlocation <= 5 Then
    '        WallFar.Visible = True
    '    Else
    '        WallFar.Visible = False
    '    End If
    '    If selectedlocation <= 10 And selectedlocation > 5 Then
    '        WallMedium.Visible = True
    '    Else
    '        WallMedium.Visible = False
    '    End If
    '    If selectedlocation > 12 Then
    '        WallNear.Visible = True
    '    Else
    '        WallNear.Visible = False
    '    End If
    'End If
    
    
        x1 = walldecorationgroups(selectedgroup, selectedlocation).x1
        y1 = walldecorationgroups(selectedgroup, selectedlocation).y1
        x2 = walldecorationgroups(selectedgroup, selectedlocation).x2
        y2 = walldecorationgroups(selectedgroup, selectedlocation).y2
    
        
        X1Coord.Text = Str(x1)
        Y1Coord.Text = Str(y1)
        X2Coord.Text = Str(x2)
        Y2Coord.Text = Str(y2)
        
        'If X > 0 Or Y > 0 Or subclickchange = True Then
        
            If y2 < y1 Then
                y2 = y1 + 1
            End If
            If x2 < x1 Then
                x2 = x1 + 1
            End If
            
            x1 = x1 * 2
            y1 = y1 * 2
            x2 = x2 * 2
            y2 = y2 * 2
            
            GLocRect.Left = x1
            GLocRect.Top = y1
            GLocRect.width = (x2 - x1) + 2
            GLocRect.height = (y2 - y1) + 2
            GSelectBox.Left = x1 - 16
            GSelectBox.Top = y1 - 16
            If subclickchange = False Then
                GLocPointer.Left = x1 - 16
                GLocPointer.Top = y1 - 16
            End If
            
            GLocRect.Visible = True
            GSelectBox.Visible = True
            GLocPointer.Visible = True
        'Else
        '    HLine.Visible = False
        '    VLine.Visible = False
        '    SelectBox.Visible = False
        '    LocPointer.Visible = False
        'End If
        '164 close, 103 medium, 84 long
        'so at medium, the height is 62% of the normal
        'at long, the height is 50% of the normal
        If CGDecorationList.ListIndex > -1 Then

            selectedimage = 121 + 2 * (selecteddecoration - 1)
            '3,4,5,8,9,10,13 = front version
            '2,7,12 = mirrored
            If selectedlocation = 3 Or selectedlocation = 4 Or selectedlocation = 5 Or selectedlocation = 8 Or selectedlocation = 9 Or selectedlocation = 10 Or selectedlocation = 13 Then
                selectedimage = selectedimage + 1
            End If
            If selectedlocation = 2 Or selectedlocation = 7 Or selectedlocation = 12 Then
                graphics.setmirrored (1)
            End If
            graphics.stretchtransparentbmp Graphic.hdc, selectedimage, _
                x1, y1, (x2 - x1) + 2, (y2 - y1) + 2, 0, 0, 10
                
            graphics.setmirrored (0)
            'WallDecorationGraphicLeft.height = y2 - y1 + 1
            'WallDecorationGraphicLeft.width = x2 - x1 + 1
            'WallDecorationGraphicLeft.Left = ImageA.Left + x1
            'WallDecorationGraphicLeft.Top = ImageA.Top + y1
            '
            'WallDecorationGraphicRight.height = y2 - y1 + 1
            'WallDecorationGraphicRight.width = x2 - x1 + 1
            'WallDecorationGraphicRight.Left = ImageA.Left + x1
            'WallDecorationGraphicRight.Top = ImageA.Top + y1
            '
            'WallDecorationGraphicCenter.height = y2 - y1 + 1
            'WallDecorationGraphicCenter.width = x2 - x1 + 1
            'WallDecorationGraphicCenter.Left = ImageA.Left + x1
            'WallDecorationGraphicCenter.Top = ImageA.Top + y1
            '
            'If selectedlocation = 1 Or selectedlocation = 6 Or selectedlocation = 11 Then
            '    Me.WallDecorationGraphicLeft.Visible = True
            '    Me.WallDecorationGraphicRight.Visible = False
            '    Me.WallDecorationGraphicCenter.Visible = False
            'ElseIf selectedlocation = 2 Or selectedlocation = 7 Or selectedlocation = 12 Then
            '    Me.WallDecorationGraphicLeft.Visible = False
            '    Me.WallDecorationGraphicRight.Visible = True
            '    Me.WallDecorationGraphicCenter.Visible = False
            'Else
            '    Me.WallDecorationGraphicLeft.Visible = False
            '    Me.WallDecorationGraphicRight.Visible = False
            '    Me.WallDecorationGraphicCenter.Visible = True
            'End If
        'Else
        '    Me.WallDecorationGraphicLeft.Visible = False
        '    Me.WallDecorationGraphicRight.Visible = False
        '    Me.WallDecorationGraphicCenter.Visible = False
        End If
        
    Graphic.Refresh
End Sub

Private Sub PaletteInfo_Click()
    Dim i As Integer
    Dim p As CustomPaletteEditor
    Set p = New CustomPaletteEditor
    For i = 1 To 16
        p.setd2palette i, graphics.f558.d2walldecorationpalette(i)
        p.setd3palette i, graphics.f558.d3walldecorationpalette(i)
    Next
    Set p.returnWallDecorationGraphicInfoEditor = Me
    p.returnTo = 2
    p.init
    p.Show
End Sub
Private Sub X1Coord_Change()
    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    walldecorationgroups(selectedgroup, selectedlocation).x1 = App.EFChange8(X1Coord, 0, 255)
    update
    subchange = False
End Sub

Private Sub Y1Coord_Change()
    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    walldecorationgroups(selectedgroup, selectedlocation).y1 = App.EFChange8(Y1Coord, 0, 255)
    update
    subchange = False
End Sub



Private Sub X2Coord_Change()
    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    walldecorationgroups(selectedgroup, selectedlocation).x2 = App.EFChange8(X2Coord, 0, 255)
    update
    subchange = False
End Sub

Private Sub Y2Coord_Change()
    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    walldecorationgroups(selectedgroup, selectedlocation).y2 = App.EFChange8(Y2Coord, 0, 255)
    update
    subchange = False
End Sub


Private Sub Gheight_Change()
    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    walldecorationgroups(selectedgroup, selectedlocation).height = App.EFChange8(GHeight, 0, 255)
    subchange = False
End Sub
Private Sub Gwidth_Change()
    If subchange = True Then
        Exit Sub
    End If
    subchange = True
    walldecorationgroups(selectedgroup, selectedlocation).width = App.EFChange8(GWidth, 0, 255)
    subchange = False
End Sub






