VERSION 5.00
Object = "{0D452EE1-E08F-101A-852E-02608C4D0BB4}#2.0#0"; "FM20.DLL"
Begin VB.Form ItemTypeChooser 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Select Item Type..."
   ClientHeight    =   7410
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   7935
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   494
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   529
   StartUpPosition =   3  'Windows Default
   Begin VB.PictureBox Graphic 
      AutoRedraw      =   -1  'True
      Height          =   6780
      Left            =   90
      ScaleHeight     =   448
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   512
      TabIndex        =   4
      Top             =   90
      Width           =   7740
      Begin VB.Shape SelectBox 
         BorderColor     =   &H00FFFF00&
         BorderWidth     =   2
         Height          =   480
         Left            =   0
         Top             =   0
         Width           =   480
      End
   End
   Begin VB.TextBox ItemName 
      Enabled         =   0   'False
      Height          =   285
      Left            =   3240
      Locked          =   -1  'True
      TabIndex        =   1
      Top             =   6960
      Width           =   2535
   End
   Begin MSForms.CommandButton Cancel 
      Cancel          =   -1  'True
      Height          =   375
      Left            =   6480
      TabIndex        =   3
      Top             =   6960
      Width           =   1335
      Caption         =   "Cancel"
      Size            =   "2355;661"
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.CommandButton Ok 
      Default         =   -1  'True
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   6960
      Width           =   1335
      Caption         =   "Ok"
      Size            =   "2355;661"
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   3
   End
   Begin MSForms.Label ST 
      Height          =   255
      Index           =   0
      Left            =   1680
      TabIndex        =   0
      Top             =   6960
      Width           =   1455
      Caption         =   "name:"
      Size            =   "2566;450"
      FontHeight      =   165
      FontCharSet     =   0
      FontPitchAndFamily=   2
      ParagraphAlign  =   2
   End
End
Attribute VB_Name = "ItemTypeChooser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public selecteditem As Integer
Public obj As obj
Public textfield As TextBox



Public Function init()
    selectitem (0)

    'graphics.resetmodifiedcolorarray
    'ItemGraphics(0).Picture = graphics.loadgraphic(43, 0)
    'ItemGraphics(1).Picture = graphics.loadgraphic(44, 0)
    'ItemGraphics(2).Picture = graphics.loadgraphic(45, 0)
    'ItemGraphics(3).Picture = graphics.loadgraphic(46, 0)
    'ItemGraphics(4).Picture = graphics.loadgraphic(47, 0)
    'ItemGraphics(5).Picture = graphics.loadgraphic(48, 0)
    'ItemGraphics(6).Picture = graphics.loadgraphic(49, 0)
    
    graphics.curPalette = (graphics.gPALETTE_MAIN)
    graphics.stretchbmpby Graphic.hdc, 42, 0, 0, 0, 0, 200, 200
    graphics.stretchbmpby Graphic.hdc, 43, 0, 64, 0, 0, 200, 200
    graphics.stretchbmpby Graphic.hdc, 44, 0, 128, 0, 0, 200, 200
    graphics.stretchbmpby Graphic.hdc, 45, 0, 192, 0, 0, 200, 200
    graphics.stretchbmpby Graphic.hdc, 46, 0, 256, 0, 0, 200, 200
    graphics.stretchbmpby Graphic.hdc, 47, 0, 320, 0, 0, 200, 200
    graphics.stretchbmpby Graphic.hdc, 48, 0, 384, 0, 0, 200, 200
    
End Function

Private Sub Cancel_Click()
    unload Me
    
End Sub


Private Sub Graphic_MouseDown(button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim itemnum As Integer
    Dim cx As Integer
    Dim cy As Integer
    'x = x * 4 / 3
    'y = y * 4 / 3
    'y = y + (Index * 64)
    'MsgBox "Mousedown coords: (" + Str(X) + "," + Str(Y) + ")"
    
    cx = X
    cy = Y
    cx = cx - (cx And &H1F)
    cy = cy - (cy And &H1F)
    cx = cx / 32
    cy = cy / 32
    itemnum = cx + (cy * 16)
    If itemnum < 200 Then
        selectitem (itemnum)
    End If
    'MsgBox "Mousedown on itemnum: " + Str(itemnum)
End Sub

Private Sub ItemGraphics_MouseDown(Index As Integer, button As Integer, Shift As Integer, X As Single, Y As Single)
    Dim itemnum As Integer
    Dim cx As Integer
    Dim cy As Integer
    X = X * 4 / 3
    Y = Y * 4 / 3
    Y = Y + (Index * 64)
    'MsgBox "Mousedown coords: (" + Str(X) + "," + Str(Y) + ")"
    
    cx = X
    cy = Y
    cx = cx - (cx And &H1F)
    cy = cy - (cy And &H1F)
    cx = cx / 32
    cy = cy / 32
    itemnum = cx + (cy * 16)
    If itemnum < 200 Then
        selectitem (itemnum)
    End If
    'MsgBox "Mousedown on itemnum: " + Str(itemnum)
End Sub

Function selectitem(ByVal num As Integer)
    Dim X As Integer
    Dim Y As Integer
    
    If num < 0 Or num >= 200 Then
        Exit Function
    End If
    
    X = num And &HF
    Y = (num - X) / 16
    SelectBox.Left = X * 32
    SelectBox.Top = Y * 32
    
    selecteditem = num
    
    ItemName.Text = App.graphics.f556.objstring(num + 1)
    
End Function

Private Sub Ok_Click()
    obj.ItemType = selecteditem
    textfield.Text = Str(obj.ItemType)
    unload Me
End Sub
