Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' =====================================================================
- ' S1 Hacking Studio - Main Core
- ' Версия 2.0
- ' =====================================================================
- ' (c) 2010, Vladikcomper
- ' =====================================================================
- Option Explicit
- Private Declare Function DrawTransparent Lib "msimg32" Alias "TransparentBlt" _
- (ByVal hdcDest As Long, ByVal nXOriginDest As Long, ByVal nYOriginDest As Long, _
- ByVal nWidthDest As Long, ByVal nHeightDest As Long, ByVal hdcSrc As Long, _
- ByVal nXOriginSrc As Long, ByVal nYOriginSrc As Long, ByVal nWidthSrc As Long, _
- ByVal nHeightSrc As Long, ByVal crTransparent As Long) As Long
- Private Declare Function StretchBlt Lib "gdi32" (ByVal hDC As Long, _
- ByVal x As Long, ByVal Y As Long, ByVal nWidth As Long, _
- ByVal nHeight As Long, ByVal hSrcDC As Long, _
- ByVal xSrc As Long, ByVal ySrc As Long, _
- ByVal hSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
- Private Const SRCCOPY = &HCC0020
- Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
- (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
- ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) _
- As Long
- Const SW_SHOWNORMAL = 1
- ' -------------------------------
- ' Переменные менюшечного модуля
- ' -------------------------------
- Private Type clsMenuItem
- strId As Byte
- frmId As Byte
- Xstart As Integer
- Xend As Integer
- End Type
- Dim mnuStrings() As String ' Массив надписей для меню
- Dim mnuCommand() As String ' Массив команд для субменю
- Dim mnuItem() As clsMenuItem ' Массив элементов меню
- Dim mnuSubItem() As clsMenuItem ' Массив элементов субменю
- Dim mnuSubDisplay As Boolean ' Флаг отображения субменю
- Dim mnuCurrentItem As Byte ' Текущий пункт меню
- Dim mnuCurrentSubItem As Byte ' Текущий пункт субменю
- Dim mnuSelectedItem As Byte ' Выделенный пункт меню
- Dim mnuSelectedSubItem As Byte ' Выделенный пункт субменю
- Dim mnuItemYstart As Integer
- Dim mnuItemYend As Integer
- Dim mnuSubItemYstart As Integer
- Dim mnuSubItemYend As Integer
- Const mnuItemCount% = 5 ' Количество пунктов меню
- Const mnuItemStartUp% = 5 ' Вкладка по умолчанке при запуске
- Const mnuLeft% = 10 ' Отступ слева
- Const mnuBottom% = 0 ' Отступ снизу
- Const mnuItemSize% = 10 ' Размер шрифта для элемента меню
- Const mnuSubItemSize% = 9 ' Размер шрифта для субменю
- Const mnuActColor As Long = &HEBE0D1
- Const mnuSelColor As Long = &HDBD0BF
- ' ------------------------------
- ' Переменные текстового модуля
- ' ------------------------------
- Dim ttxData(23, 20) As Byte ' Массив символов Левел Селекта
- Dim ttxPointX As Byte, ttxPointY As Byte ' Координаты курсора
- ' ##################################################################### '
- ' # * ОСНОВНЫЕ ПРОЦЕДУРЫ И ФУНКЦИИ * # '
- ' ##################################################################### '
- ' =====================================================================
- ' Инициализация программы
- ' =====================================================================
- Sub Init()
- ' On Error GoTo bug
- Dim F%, St$
- F = FreeFile
- ' Подготовка формы
- Dim obj As Control
- For Each obj In lbl: obj.BackStyle = 0: Next
- For Each obj In frm: obj.BackColor = Me.BackColor: Next
- Set obj = Nothing
- frm(7).BackColor = 0
- ' Проверка папок
- If Dir(App.path & "\SourceCode", vbDirectory) = "" Then _
- Err.Raise 1003, , "Отсутсвует папка SourceCode."
- ' Читаем группы музыки
- Open App.path & "\Data\musiclist.dat" For Input As #F
- Dim i As Byte
- Do Until EOF(F)
- Line Input #F, St
- lstManagerGroup.AddItem St
- For i = 0 To cmbMusGroup.UBound
- cmbMusGroup(i).AddItem St
- Next i
- Loop
- Close #F
- lstManagerGroup.ListIndex = 0
- ' Загружаем текст меню выбора уровней
- Open App.path & "\SourceCode\misc\menutext.bin" For Binary As #F
- Get #F, , ttxData()
- Close #F
- Exit Sub
- bug:
- MsgBox "Произошла ошибка при запуске: " & Err.Description, vbCritical, _
- "Вот невезуха!"
- End
- End Sub
- ' =====================================================================
- ' Сохранение настроек программы
- ' =====================================================================
- Sub SaveData()
- On Error GoTo bug
- ' -----------------------------------------
- ' Сохранение конфигурации в Data\hack.bin
- ' -----------------------------------------
- Dim F%, i%: F = FreeFile
- Open App.path & "\Data\hack.bin" For Binary As #F
- Dim tmpString256 As String * 256 ' Шаблон строки 256 символов
- Dim tmpString64 As String * 64 ' Шаблон строки 64 символа
- Dim tmpString16 As String * 16 ' Шаблон строки 16 символов
- Dim tmpBoolean As Boolean
- Dim tmpByte As Byte
- ' [PUT] Главные параметры
- For i = 0 To 2
- tmpByte = chkOption(i).Value
- Put #F, , tmpByte
- Next i
- tmpByte = &HFF
- For i = 1 To 5: Put #F, , tmpByte: Next ' пропустить 5 байтов
- ' [PUT] Твикинг
- For i = 0 To 4
- tmpByte = chkSonic(i).Value ' Соник
- Put #F, , tmpByte
- Next i
- For i = 0 To 5
- tmpByte = Abs(vsBoss(i)) ' Удары у боссов
- Put #F, , tmpByte
- Next i
- For i = 0 To 1
- tmpByte = chkArt(i).Value ' Замена арта
- Put #F, , tmpByte
- Next i
- For i = 1 To 3: Put #F, , tmpByte: Next ' пропустить 3 байта
- Dim obj As Control
- For Each obj In optArtMon: Put #F, , CByte(IIf(obj.Value, 1, 0)): Next
- For Each obj In optArtHUD: Put #F, , CByte(IIf(obj.Value, 1, 0)): Next
- tmpByte = &HFF
- Put #F, , tmpByte ' пропустить 1 байт
- ' [PUT] Названия зон
- For i = 0 To 1
- tmpByte = chkZoneAct(i).Value ' Флажки
- Put #F, , tmpByte
- Next
- For i = 0 To 8
- tmpString16 = txtZone(i) ' Названия
- Put #F, , tmpString16
- Next
- ' [PUT] Порядок уровней
- For i = 0 To 19
- tmpByte = lstLvlOrder.ItemData(i)
- Put #F, , tmpByte
- Next i
- tmpByte = &HFF
- For i = 1 To 12: Put #F, , tmpByte: Next ' пропустить 12 байт
- ' [PUT] Настройки музыки
- For i = 0 To cmbMusGroup.UBound
- tmpString64 = cmbMusGroup(i) & "_" & Replace(cmbMusList(i), " ", "_")
- Put #F, , tmpString64
- Next i
- ' [PUT] Каталог компиляции
- tmpString256 = txtCompPath
- Put #F, , tmpString256
- Close #F
- ' ---------------------------------------------------------
- ' Генерация файла config.asm с основными настройками хака
- ' ---------------------------------------------------------
- If chkOption(1).Value = 1 Then GoTo SkipConfig
- F = FreeFile
- Open App.path & "\SourceCode\config.asm" For Output As #F
- Dim ArrTxt() As Byte
- ArrTxt() = LoadResData(101, "TXT_CHUNKS")
- For i = 0 To 501: Print #F, Chr(ArrTxt(i));: Next
- Print #F, "_DEBUG_" & Chr(9) & Chr(9) & "equ " & chkSonic(4).Value & vbCrLf
- Print #F, "; Sonic Tweaking"
- Dim ArrStr(5) As String
- ArrStr(0) = "_SPINDASH_": ArrStr(1) = "_JUMPDASH_"
- ArrStr(2) = "_SPEEDCAPFIX_": ArrStr(3) = "_SPIKEBUGFIX_"
- For i = 0 To 3: Print #F, ArrStr(i) & Chr(9) & "equ " & chkSonic(i): Next
- Print #F, vbCrLf
- Print #F, "; Boss Hits"
- ArrStr(0) = "GHZ": ArrStr(1) = "MZ": ArrStr(2) = "SYZ"
- ArrStr(3) = "LZ": ArrStr(4) = "SLZ": ArrStr(5) = "FZ"
- For i = 0 To 5
- Print #F, "var_BHits_" & ArrStr(i) & Chr(9) & "= " & Abs(vsBoss(i).Value)
- Next
- Close #F
- SkipConfig:
- ' ----------------------------
- ' Применения порядка уровней
- ' ----------------------------
- F = FreeFile
- Open App.path & "\SourceCode\misc\lvl_ord.bin" For Binary As #F
- Dim ii%, iii%, NextLevel%, out%
- For i = 0 To 5
- For ii = 0 To IIf(i = 1, 3, 2)
- Select Case i * 100 + ii ' Определить Id зоны в списке
- Case 103: out = 17 ' - Scrap Brain 3 (LZ 4)
- Case 502: out = 18 ' - Final Zone
- Case Else: out = i * 3 + ii
- End Select
- For iii = 0 To 19 ' Найти позицию в списке по Id
- If lstLvlOrder.ItemData(iii) = out Then Exit For
- Next iii
- If iii = 19 Then
- NextLevel = 0
- Else: NextLevel = lstLvlOrder.ItemData(iii + 1)
- End If
- Select Case NextLevel ' Определить номер уровня по Id
- Case 0: out = 0
- Case 18: out = &H205 ' $0502 - Final Zone
- Case 17: out = &H301 ' $0103 - Scrap Brain 3 (LZ 4)
- Case &H80: out = 0
- Case Else: out = (NextLevel Mod 3) * &H100 + NextLevel \ 3
- End Select
- Put #F, , out
- Next ii
- out = 0
- If ii < 4 Then Put #F, , out ' Пропустить 2 байта
- Next i
- Close #F
- ' ---------------------------------------
- ' Сохранение текста меню выбора уровней
- ' ---------------------------------------
- Open App.path & "\SourceCode\misc\menutext.bin" For Binary As #F
- Put #F, , ttxData()
- Close #F
- ' ---------------------
- ' Генерация build.bat
- ' ---------------------
- Open App.path & "\SourceCode\build.bat" For Output As #F
- ArrTxt() = LoadResData(102, "TXT_CHUNKS")
- For i = 0 To 124: Print #F, Chr(ArrTxt(i));: Next
- If chkOption(0).Value = 0 Then Print #F, "_exec\rompad s1built.bin 255 0"
- Print #F, "_exec\fixheadr s1built.bin"
- Print #F, "copy s1built.bin " & Chr(34) & txtCompPath & Chr(34)
- Print #F, "pause"
- Close #F
- ' ------------------------------------------------
- ' Замена музыки в дизасембле на выбранную в S1HS
- ' ------------------------------------------------
- For i = &H81 To &H93 ' песни $81-$93
- If Dir(App.path & "\SourceCode\sound\music" & Hex$(i) & ".bin") <> "" Then _
- Kill App.path & "\SourceCode\sound\music" & Hex$(i) & ".bin"
- FileCopy App.path & "\Music\" & cmbMusGroup(i - &H81) & "_" & _
- Replace(cmbMusList(i - &H81), " ", "_"), _
- App.path & "\SourceCode\sound\music" & Hex$(i) & ".bin"
- Next i
- Open App.path & "\Data\musicset.dat" For Input As #F ' прочая музыка
- Dim St$
- Line Input #F, St
- Dim arr() As String
- arr() = Split(St, " ")
- For i = 0 To UBound(arr)
- If Dir(App.path & "\SourceCode\sound\music" & arr(i) & ".bin") <> "" Then _
- Kill App.path & "\SourceCode\sound\music" & arr(i) & ".bin"
- FileCopy App.path & "\Music\" & cmbMusGroup(i + 19) & "_" & _
- Replace(cmbMusList(i + 19), " ", "_"), _
- App.path & "\SourceCode\sound\music" & arr(i) & ".bin"
- Next i
- Close #F
- ' --------------------------
- ' Замена арта в дизасембле
- ' --------------------------
- If chkArt(0).Value = 1 Then ' Арт Мониторов
- If Dir(App.path & "\SourceCode\artnem\monitors.bin") <> "" Then _
- Kill App.path & "\SourceCode\artnem\monitors.bin"
- If optArtMon(0).Value = True Then ' Sonic 1
- FileCopy App.path & "\Data\art_Monitors_S1.bin", _
- App.path & "\SourceCode\artnem\monitors.bin"
- Else ' Sonic 3
- FileCopy App.path & "\Data\art_Monitors_S3.bin", _
- App.path & "\SourceCode\artnem\monitors.bin"
- End If
- End If
- If chkArt(1).Value = 1 Then ' Арт HUD'а
- If Dir(App.path & "\SourceCode\artnem\hud.bin") <> "" Then _
- Kill App.path & "\SourceCode\artnem\hud.bin"
- If Dir(App.path & "\SourceCode\artunc\hud.bin") <> "" Then _
- Kill App.path & "\SourceCode\artunc\hud.bin"
- If optArtHUD(0).Value = True Then ' Sonic 1
- FileCopy App.path & "\Data\art_HUD1_S1.bin", _
- App.path & "\SourceCode\artnem\hud.bin"
- FileCopy App.path & "\Data\art_HUD2_S1.bin", _
- App.path & "\SourceCode\artunc\hud.bin"
- ElseIf optArtHUD(1).Value = True Then ' Sonic 2
- FileCopy App.path & "\Data\art_HUD1_S2.bin", _
- App.path & "\SourceCode\artnem\hud.bin"
- FileCopy App.path & "\Data\art_HUD2_S2.bin", _
- App.path & "\SourceCode\artunc\hud.bin"
- Else ' Sonic 3
- FileCopy App.path & "\Data\art_HUD1_S3.bin", _
- App.path & "\SourceCode\artnem\hud.bin"
- FileCopy App.path & "\Data\art_HUD2_S1.bin", _
- App.path & "\SourceCode\artunc\hud.bin"
- End If
- End If
- ' -----------------------------------
- ' Генерация текстов для Title Cards
- ' -----------------------------------
- If chkOption(2).Value = 1 Then GoTo SkipCards
- Dim ArrM() As Byte ' (x,4) - массив маппингов (формат Sonic 1)
- Dim SingleX As Byte ' Текущая X-координата
- Dim SingleW As Byte ' Ширина буквы (формат Sonic 1)
- Dim SingleCode As Byte ' Код буквы (формат Sonic 1)
- Dim RLen As Byte ' Количество символов (без пробелов)
- Dim NLen As Byte ' Количество символов (с пробелами)
- Open App.path & "\Data\ttlcards.bin" For Binary As #F
- Dim D%, c As Byte
- For i = 0 To 6
- RLen = Len(Replace(txtZone(i), " ", "")) - 1
- NLen = Len(txtZone(i)) - 1
- ReDim ArrM(4, RLen) As Byte ' Создать массив маппингов
- SingleX = 0 ' Очистить X-координату
- c = 0 ' Счетчик символов (не реагирует на пробелы)
- ' Построение спрайтов для каждого символа
- For ii = 0 To NLen
- If Mid(txtZone(i), ii + 1, 1) = " " Then ' Пробел
- SingleX = SingleX + 16
- Else ' Буквенный символ
- Seek #F, (Asc(Mid(txtZone(i), ii + 1, 1)) - 64) * 2 - 1
- Get #F, , SingleW ' получить ширину (формат С1)
- Get #F, , SingleCode ' получить код (начальный тайл)
- ArrM(0, c) = &HF8 ' Y-координата
- ArrM(1, c) = IIf(SingleW = &H10, 5, 1) ' Ширина спрайта
- ArrM(3, c) = SingleCode ' Номер тайла
- ArrM(4, c) = SingleX ' X-координата
- SingleX = SingleX + SingleW
- c = c + 1
- End If
- Next ii
- ' Скоординировать буквы относительно центра спрайта
- Dim RealX%, CurrX%
- RealX = 256 - CInt(SingleX) \ 2
- For ii = 0 To RLen
- CurrX = RealX + CInt(ArrM(4, ii))
- ArrM(4, ii) = IIf(CurrX > 255, CurrX - 256, CurrX)
- Next ii
- ' Записать маппинги в файлы
- D = FreeFile
- If Dir(App.path & "\SourceCode\mapbin\ttlcards_map_" & i & ".bin") <> "" Then _
- Kill App.path & "\SourceCode\mapbin\ttlcards_map_" & i & ".bin"
- Open App.path & "\SourceCode\mapbin\ttlcards_map_" & i & ".bin" For Binary As #D
- RLen = RLen + 1
- Put #D, , RLen
- Put #D, , ArrM()
- Close #D
- ' Сгенерировать конфигурацию
- If Dir(App.path & "\SourceCode\mapbin\ttlcards_cfg_" & i & ".bin") <> "" Then _
- Kill App.path & "\SourceCode\mapbin\ttlcards_cfg_" & i & ".bin"
- Open App.path & "\SourceCode\mapbin\ttlcards_cfg_" & i & ".bin" For Binary As #D
- ' Zone Name
- tmpByte = 0: Put #D, , tmpByte: Put #D, , tmpByte
- tmpByte = 1: Put #D, , tmpByte
- tmpByte = &H20: Put #D, , tmpByte
- ' "ZONE"
- Dim CurrX2 As Long
- CurrX2 = ((SingleX \ 2) + &H120 - 16 * 3) - &H240
- CurrX2 = &H10000 + CurrX2 ' start pos
- tmpByte = CurrX2 \ &H100: Put #D, , tmpByte
- tmpByte = CurrX2 Mod &H100: Put #D, , tmpByte
- CurrX2 = (SingleX \ 2) + &H120 - 16 * 3 ' end pos
- If i = 6 And chkZoneAct(0).Value = 0 Then CurrX2 = CurrX2 + &H10
- tmpByte = CurrX2 \ &H100: Put #D, , tmpByte
- tmpByte = CurrX2 Mod &H100: Put #D, , tmpByte
- ' "ACT X"
- CurrX2 = ((SingleX \ 2) - 16 * 3 + &H120) + &H18 + &H2C0 ' start pos
- tmpByte = CurrX2 \ &H100: Put #D, , tmpByte
- tmpByte = CurrX2 Mod &H100: Put #D, , tmpByte
- CurrX2 = CurrX2 - &H2C0 ' end pos
- If i = 6 And chkZoneAct(0).Value = 0 Then CurrX2 = CurrX2 + &H2C0
- tmpByte = CurrX2 \ &H100: Put #D, , tmpByte
- tmpByte = CurrX2 Mod &H100: Put #D, , tmpByte
- ' Oval
- CurrX2 = ((SingleX \ 2) - 16 * 3 + &H120) + &H18 + &HC0 ' start pos
- tmpByte = CurrX2 \ &H100: Put #D, , tmpByte
- tmpByte = CurrX2 Mod &H100: Put #D, , tmpByte
- CurrX2 = CurrX2 - &HC0 ' end pos
- tmpByte = CurrX2 \ &H100: Put #D, , tmpByte
- tmpByte = CurrX2 Mod &H100: Put #D, , tmpByte
- Close #D
- Next i
- Close #F
- ' ------------------------------------------------
- ' Генерация текста для экрана "SONIC HAS PASSED"
- ' ------------------------------------------------
- Open App.path & "\Data\ttlcards.bin" For Binary As #F
- For i = 7 To 8
- RLen = Len(Replace(txtZone(i), " ", "")) - 1
- NLen = Len(txtZone(i)) - 1
- ReDim ArrM(4, RLen) As Byte ' Создать массив маппингов
- SingleX = 0
- c = 0
- ' Построение спрайтов для каждого символа
- For ii = 0 To NLen
- If Mid(txtZone(i), ii + 1, 1) = " " Then ' Пробел
- SingleX = SingleX + 16
- Else ' Буквенный символ
- Seek #F, (Asc(Mid(txtZone(i), ii + 1, 1)) - 64) * 2 - 1
- Get #F, , SingleW ' получить ширину (формат С1)
- Get #F, , SingleCode ' получить код (начальный тайл)
- ArrM(0, c) = &HF8 ' Y-координата
- ArrM(1, c) = IIf(SingleW = &H10, 5, 1) ' Ширина спрайта
- ArrM(3, c) = SingleCode ' Номер тайла
- ArrM(4, c) = SingleX ' X-координата
- SingleX = SingleX + SingleW
- c = c + 1
- End If
- Next ii
- ' Скоординировать буквы относительно центра спрайта
- RealX = 256 - (SingleX - IIf(i = 7, &H40, IIf(chkZoneAct(1).Value = 1, &H30, &H38)))
- For ii = 0 To RLen
- CurrX = RealX + CInt(ArrM(4, ii))
- ArrM(4, ii) = IIf(CurrX > 255, CurrX - 256, CurrX)
- Next ii
- ' Записать маппинги в файлы
- D = FreeFile
- If Dir(App.path & "\SourceCode\mapbin\sonichaspassed_map_" & i - 7 & ".bin") <> "" Then _
- Kill App.path & "\SourceCode\mapbin\sonichaspassed_map_" & i - 7 & ".bin"
- Open App.path & "\SourceCode\mapbin\sonichaspassed_map_" & i - 7 & ".bin" For Binary As #D
- RLen = RLen + 1
- Put #D, , RLen
- Put #D, , ArrM()
- Close #D
- Next i
- ' Сгенерировать конфигурацию для спрайта "ACT X"
- If Dir(App.path & "\SourceCode\mapbin\sonichaspassed_actconf.bin") <> "" Then _
- Kill App.path & "\SourceCode\mapbin\sonichaspassed_actconf.bin"
- Open App.path & "\SourceCode\mapbin\sonichaspassed_actconf.bin" For Binary As #D
- tmpByte = 4: Put #D, , tmpByte ' start pos: $40C
- tmpByte = &HC: Put #D, , tmpByte
- tmpByte = IIf(chkZoneAct(1).Value = 1, 1, 4): Put #D, , tmpByte ' end pos
- tmpByte = IIf(chkZoneAct(1).Value = 1, &H4C, &HC): Put #D, , tmpByte
- tmpByte = 0: Put #D, , tmpByte ' y-pos
- tmpByte = &HD6: Put #D, , tmpByte
- Close #D
- Close #F
- SkipCards:
- Exit Sub
- bug:
- MsgBox "Произошла ошибка при сохранении: " & Err.Description, vbCritical, _
- "Вот невезуха!"
- End Sub
- ' =====================================================================
- ' Загрузка настроек программы
- ' =====================================================================
- Sub LoadData()
- On Error GoTo bug
- Dim F%, i%: F = FreeFile
- Open App.path & "\Data\hack.bin" For Binary As #F
- Dim tmpString256 As String * 256 ' Шаблон строки 256 символов
- Dim tmpString64 As String * 64 ' Шаблон строки 64 символа
- Dim tmpString16 As String * 16 ' Шаблон строки 16 символов
- Dim tmpBoolean As Boolean
- Dim tmpByte As Byte
- ' [GET] Основные параметры
- For i = 0 To 2
- Get #F, , tmpByte
- chkOption(i).Value = tmpByte
- chkOption_Click i
- Next
- For i = 1 To 5: Get #F, , tmpByte: Next ' пропустить 5 байтов
- ' [GET] Твикинг
- For i = 0 To 4
- Get #F, , tmpByte
- chkSonic(i).Value = tmpByte ' Соник
- Next
- For i = 0 To 5
- Get #F, , tmpByte
- vsBoss(i).Value = 0 - tmpByte ' Удары у боссов
- vsBoss_Change i
- Next
- For i = 0 To 1
- Get #F, , tmpByte
- chkArt(i).Value = tmpByte ' Замена арта
- chkArt_Click i
- Next
- For i = 1 To 3: Get #F, , tmpByte: Next ' пропустить 3 байта
- Dim obj As Control
- For Each obj In optArtMon: Get #F, , tmpByte: obj.Value = IIf(tmpByte, 1, 0): Next
- For Each obj In optArtHUD: Get #F, , tmpByte: obj.Value = IIf(tmpByte, 1, 0): Next
- Get #F, , tmpByte ' пропустить 1 байт
- ' [GET] Названия зон
- For i = 0 To 1: Get #F, , tmpByte: chkZoneAct(i).Value = tmpByte: Next
- For i = 0 To 8: Get #F, , tmpString16: txtZone(i) = Trim(tmpString16): Next
- ' [GET] Порядок уровней
- For i = 0 To 19
- Get #F, , tmpByte
- lstLvlOrder.AddItem tmpByte
- lstLvlOrder.ItemData(lstLvlOrder.ListCount - 1) = tmpByte
- Next
- UpdateLevelList
- For i = 1 To 12: Get #F, , tmpByte: Next ' пропустить 12 байт
- ' [GET] Настройки музыки
- Dim arr() As String
- For i = 0 To cmbMusGroup.UBound
- Get #F, , tmpString64
- arr() = Split(Replace(tmpString64, "_", " ", , 1), " ")
- cmbMusGroup(i) = arr(0)
- cmbMusList(i) = Replace(arr(1), "_", " ")
- Next i
- ' [GET] Путь компиляции
- Get #F, , tmpString256
- txtCompPath = Trim(tmpString256)
- Close #F
- Exit Sub
- bug:
- MsgBox "Произошла ошибка при загрузке данных: " & Err.Description, vbCritical, _
- "Вот невезуха!"
- Resume Next
- End
- End Sub
- Private Sub Form_Load()
- If App.PrevInstance Then End
- Init
- InitGraph
- InitMenu
- LoadData
- End Sub
- ' ##################################################################### '
- ' # * ФУНКЦИИ УПРАВЛЕНИЯ ГЛАВНЫМ МЕНЮ * # '
- ' ##################################################################### '
- ' =====================================================================
- ' Инициализация меню
- ' =====================================================================
- Sub InitMenu()
- On Error GoTo bug
- Dim F%, i%, tmpStr$, strCount%: F = FreeFile
- Open App.path & "\Data\menu.dat" For Input As #F
- ' Загрузка строк
- Line Input #F, tmpStr
- strCount = CInt(tmpStr)
- ReDim mnuStrings(strCount)
- For i = 0 To strCount
- Line Input #F, mnuStrings(i)
- Next i
- ' Загрузка команд
- ReDim mnuCommand(mnuItemCount)
- For i = 0 To mnuItemCount
- Line Input #F, mnuCommand(i)
- Next i
- ' Настройка главного меню
- ReDim mnuItem(mnuItemCount)
- For i = 0 To mnuItemCount
- mnuItem(i).strId = i
- Next i
- Close #F
- ' Сэмулировать событие нажатия, чтобы вызвать перерисовку меню
- mnuSelectedItem = &HFF
- mnuSelectedSubItem = &HFF
- Call ClickMenuItem(mnuItemStartUp)
- Exit Sub
- bug:
- MsgBox "Ошибка при инициализации меню." & vbCrLf & Err.Description
- End Sub
- ' =====================================================================
- ' Перерисовка меню
- ' =====================================================================
- Sub RedrawMenu()
- Dim i%, cX%: cX = mnuLeft
- pctTabs.Cls
- ' Подготовка фонов
- StretchBlt pctTabs.hDC, 0, 0, pctTabs.Width, 76, _
- pctTLay.hDC, 0, 0, 1, 76, SRCCOPY ' Главный фон
- StretchBlt pctTabs.hDC, 0, 76 - 22 - mnuBottom, pctTabs.Width, 22, _
- pctTLay.hDC, 1, 27, 8, 22, SRCCOPY ' Субменю
- StretchBlt pctTabs.hDC, 0, 76 - 22 - mnuBottom - 2, pctTabs.Width, 2, _
- pctTLay.hDC, 1, 25, 1, 2, SRCCOPY ' Верхняя линия субменю
- ' Прорисовка субменю
- pctTabs.FontSize = mnuSubItemSize
- mnuSubItemYend = pctTabs.Height - mnuBottom - 2 - 22 \ 2 + _
- pctTabs.TextHeight("Хуй") \ 2
- mnuSubItemYstart = mnuSubItemYend - pctTabs.TextHeight("Хуй")
- If UBound(mnuSubItem) > 0 Then
- For i = 0 To UBound(mnuSubItem)
- ' Прорисовка активного пункта субменю
- If mnuCurrentSubItem = i Then
- pctTabs.Line (cX + 7 - 2, mnuSubItemYstart)-(cX + 7 + _
- pctTabs.TextWidth(mnuStrings(mnuSubItem(i).strId)) + 2, _
- mnuSubItemYend), mnuActColor, BF
- ' Прорисовка выделенного пункта субменю
- ElseIf mnuSelectedSubItem = i Then
- pctTabs.Line (cX + 7 - 2, mnuSubItemYstart)-(cX + 7 + _
- pctTabs.TextWidth(mnuStrings(mnuSubItem(i).strId)) + 2, _
- mnuSubItemYend), mnuSelColor, BF
- End If
- cX = cX + 7 ' Применить отступ
- pctTabs.CurrentY = mnuSubItemYstart
- pctTabs.CurrentX = cX
- pctTabs.Print mnuStrings(mnuSubItem(i).strId)
- mnuSubItem(i).Xstart = cX
- cX = cX + pctTabs.TextWidth(mnuStrings(mnuSubItem(i).strId)) + 7 + 2
- mnuSubItem(i).Xend = cX
- Next i
- Else
- ' Код для пустого субменю
- End If
- ' Прорисовка главного меню
- pctTabs.FontSize = mnuItemSize
- mnuItemYend = 76 - 22 - mnuBottom - 1 - 26 \ 2 + pctTabs.TextHeight("Хуй") \ 2
- mnuItemYstart = mnuItemYend - pctTabs.TextHeight("Хуй")
- cX = mnuLeft
- For i = 0 To mnuItemCount
- ' Прорисовка активной вкладки меню
- If mnuCurrentItem = i Then
- DrawTransparent pctTabs.hDC, cX, 76 - mnuBottom - 22 - 27, 7, 27, _
- pctTLay.hDC, 2, 0, 7, 27, vbWhite
- ' Ширина угла: 7
- StretchBlt pctTabs.hDC, cX + 7, 76 - mnuBottom - 22 - 27, pctTabs.TextWidth(mnuStrings(i)) + 2, 27, _
- pctTLay.hDC, 9, 0, 1, 27, SRCCOPY
- DrawTransparent pctTabs.hDC, cX + pctTabs.TextWidth(mnuStrings(i)) + 7 + 2, 76 - mnuBottom - 22 - 27, 7, 27, _
- pctTLay.hDC, 10, 0, 7, 27, vbWhite
- ' Отсуп между концом текста и завершающим углом: 2
- ' Прорисовка выделенной вкладки меню
- ElseIf mnuSelectedItem = i Then
- DrawTransparent pctTabs.hDC, cX, 76 - mnuBottom - 22 - 27, 7, 27, _
- pctTLay.hDC, 2, 49, 7, 27, vbWhite
- ' Ширина угла: 7
- StretchBlt pctTabs.hDC, cX + 7, 76 - mnuBottom - 22 - 27, pctTabs.TextWidth(mnuStrings(i)) + 2, 27, _
- pctTLay.hDC, 9, 49, 1, 27, SRCCOPY
- DrawTransparent pctTabs.hDC, cX + pctTabs.TextWidth(mnuStrings(i)) + 7 + 2, 76 - mnuBottom - 22 - 27, 7, 27, _
- pctTLay.hDC, 10, 49, 7, 27, vbWhite
- ' Отсуп между концом текста и завершающим углом: 2
- End If
- cX = cX + 7 ' Применить отступ
- pctTabs.CurrentY = mnuItemYstart
- pctTabs.CurrentX = cX
- pctTabs.Print mnuStrings(i)
- mnuItem(i).Xstart = cX - 7 - 2
- cX = cX + pctTabs.TextWidth(mnuStrings(i)) + 7 + 2
- mnuItem(i).Xend = cX
- Next i
- mnuItemYstart = mnuItemYstart - 26 / 2 + pctTabs.TextHeight("Хуй") / 2
- mnuItemYend = mnuItemYend + 26 / 2 - pctTabs.TextHeight("Хуй") / 2
- End Sub
- ' =====================================================================
- ' Событие при движения мышки, выделяет неактивные вкладки
- ' =====================================================================
- Private Sub pctTabs_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
- Dim i%
- ' Область главного меню
- If Y >= mnuItemYstart And Y <= mnuItemYend Then
- If mnuSelectedSubItem <> &HFF Then mnuSelectedSubItem = &HFF: RedrawMenu
- For i = 0 To mnuItemCount
- With mnuItem(i)
- If x >= .Xstart And x <= .Xend Then
- If mnuSelectedItem <> i Then mnuSelectedItem = i: RedrawMenu
- Exit Sub
- End If
- End With
- Next i
- If mnuSelectedItem <> &HFF Then mnuSelectedItem = &HFF: RedrawMenu
- ' Область субменю
- ElseIf Y >= mnuSubItemYstart And Y <= mnuSubItemYend Then
- If mnuSelectedItem <> &HFF Then mnuSelectedItem = &HFF: RedrawMenu
- For i = 0 To UBound(mnuSubItem)
- With mnuSubItem(i)
- If x >= .Xstart And x <= .Xend Then
- If mnuSelectedSubItem <> i Then mnuSelectedSubItem = i: RedrawMenu
- Exit Sub
- End If
- End With
- Next i
- If mnuSelectedSubItem <> &HFF Then mnuSelectedSubItem = &HFF: RedrawMenu
- ' Если курсор не в области меню, сбросить все
- ElseIf mnuSelectedItem <> &HFF Or mnuSelectedSubItem <> &HFF Then
- mnuSelectedItem = &HFF
- mnuSelectedSubItem = &HFF
- RedrawMenu
- End If
- End Sub
- ' =====================================================================
- ' Событие при щелчке, активизирует вкладки
- ' =====================================================================
- Private Sub pctTabs_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
- Dim i%
- ' Область главного меню
- If Y >= mnuItemYstart And Y <= mnuItemYend Then
- For i = 0 To mnuItemCount
- With mnuItem(i)
- If x >= .Xstart And x <= .Xend Then
- If mnuCurrentItem <> i Then ClickMenuItem (i)
- Exit Sub
- End If
- End With
- Next i
- ' Область субменю
- ElseIf Y >= mnuSubItemYstart And Y <= mnuSubItemYend Then
- For i = 0 To UBound(mnuSubItem)
- With mnuSubItem(i)
- If x >= .Xstart And x <= .Xend Then
- If mnuCurrentSubItem <> i Then ClickMenuSubItem (i)
- Exit Sub
- End If
- End With
- Next i
- End If
- End Sub
- ' =====================================================================
- ' Активизирует выбранную вкладку меню
- ' =====================================================================
- Sub ClickMenuItem(Index As Integer)
- Dim tmpArr() As String, arrStrId() As String, arrFrmId() As String, i%
- tmpArr() = Split(mnuCommand(Index), ":")
- arrStrId() = Split(tmpArr(0), ",")
- arrFrmId() = Split(tmpArr(1), ",")
- ReDim mnuSubItem(UBound(arrStrId))
- For i = 0 To UBound(arrStrId)
- With mnuSubItem(i)
- .frmId = CByte(arrFrmId(i)) ' Команда субменю
- .strId = CByte(arrStrId(i)) ' Номер надписи субменю
- End With
- Next i
- mnuCurrentItem = Index
- Call ClickMenuSubItem(0) ' Переключиться на первую вкладку субменю
- End Sub
- ' =====================================================================
- ' Активизирует выбранную вкладку субменю
- ' =====================================================================
- Sub ClickMenuSubItem(Index As Integer)
- On Error Resume Next
- Dim obj As Control
- For Each obj In frm: obj.Visible = False: Next
- frm(mnuSubItem(Index).frmId).Visible = True
- Set obj = Nothing
- mnuCurrentSubItem = Index
- RedrawMenu
- End Sub
- ' ##################################################################### '
- ' # * РЕДАКТОР ТЕКСТА ЛЕВЕЛ СЕЛЕКТА * # '
- ' ##################################################################### '
- ' =====================================================================
- ' Инициализация графики
- ' =====================================================================
- Sub InitGraph()
- GraphDraw
- End Sub
- ' =====================================================================
- ' Перерисовка содержимого редактора
- ' =====================================================================
- Sub GraphDraw()
- Dim i As Byte, ii As Byte
- pctText.Cls
- pctText.Line (ttxPointX * 16, ttxPointY * 16)-(ttxPointX * 16 + 16, ttxPointY * 16 + 16), _
- RGB(255, 0, 255), BF
- For i = 0 To 23
- For ii = 0 To 20
- If ttxData(i, ii) <> 255 Then _
- DrawTransparent pctText.hDC, i * 16, ii * 16, 16, 16, _
- pctTextTemp.hDC, (ttxData(i, ii) Mod 16) * 16, (ttxData(i, ii) \ 16) * 16, _
- 16, 16, vbBlack
- Next ii
- Next i
- End Sub
- ' =====================================================================
- ' Обработка нажатий клавиш в редакторе
- ' =====================================================================
- Private Sub pctText_KeyDown(KeyCode As Integer, Shift As Integer)
- Dim i As Byte
- Select Case KeyCode
- Case 37 ' left
- If ttxPointX > 0 Then ttxPointX = ttxPointX - 1: GraphDraw
- Case 38 ' up
- If ttxPointY > 0 Then
- ttxPointY = ttxPointY - 1: GraphDraw
- End If
- Case 39 ' right
- If ttxPointX < 23 Then ttxPointX = ttxPointX + 1: GraphDraw
- Case 40 ' down
- If ttxPointY < 20 Then
- ttxPointY = ttxPointY + 1: GraphDraw
- End If
- Case 46 ' del
- For i = ttxPointX To 22
- ttxData(i, ttxPointY) = ttxData(i + 1, ttxPointY)
- Next i
- ttxData(23, ttxPointY) = 255
- GraphDraw
- Case 8 ' backspace
- If ttxPointX > 0 Then
- ttxPointX = ttxPointX - 1
- 'For i = ttxPointX To 22
- ' ttxData(i, ttxPointY) = ttxData(i + 1, ttxPointY)
- 'Next i
- 'ttxData(23, ttxPointY) = 255
- ttxData(ttxPointX + 1, ttxPointY) = 255
- Else
- ttxData(ttxPointX, ttxPointY) = 255
- End If
- GraphDraw
- Case 32 ' space
- If ttxPointX < 23 Then
- ttxPointX = ttxPointX + 1
- 'For i = ttxPointX To 22
- ' ttxData(23 - i + ttxPointX, ttxPointY) = ttxData(22 - i + ttxPointX, ttxPointY)
- 'Next i
- ttxData(ttxPointX - 1, ttxPointY) = 255
- Else
- ttxData(ttxPointX, ttxPointY) = 255
- End If
- GraphDraw
- End Select
- End Sub
- ' =====================================================================
- ' Ввод текста в редактор
- ' =====================================================================
- Private Sub pctText_KeyPress(KeyAscii As Integer)
- Dim OutCode%
- If KeyAscii > 96 And KeyAscii < 121 Then ' a-x
- OutCode = KeyAscii - 96 + 16
- ElseIf KeyAscii > 64 And KeyAscii < 89 Then ' A-X
- OutCode = KeyAscii - 64 + 16
- ElseIf KeyAscii > 120 And KeyAscii < 123 Then ' y-z
- OutCode = KeyAscii - 120 + 14
- ElseIf KeyAscii > 88 And KeyAscii < 91 Then ' Y-Z
- OutCode = KeyAscii - 88 + 14
- ElseIf KeyAscii > 47 And KeyAscii < 58 Then ' 0-9
- OutCode = KeyAscii - 48
- ElseIf KeyAscii = 45 Then
- OutCode = 11
- Else
- Exit Sub
- End If
- If ttxPointX < 23 Then
- Dim i As Byte
- ttxPointX = ttxPointX + 1
- 'For i = ttxPointX To 22
- ' ttxData(23 - i + ttxPointX, ttxPointY) = ttxData(22 - i + ttxPointX, ttxPointY)
- 'Next i
- 'ttxData(ttxPointX, ttxPointY) = ttxData(ttxPointX - 1, ttxPointY)
- ttxData(ttxPointX - 1, ttxPointY) = OutCode
- GraphDraw
- Else
- ttxData(ttxPointX, ttxPointY) = OutCode
- GraphDraw
- End If
- End Sub
- ' =====================================================================
- ' Событие щелчка по области редактора
- ' =====================================================================
- Private Sub pctText_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
- If Button <> 1 Then Exit Sub
- ttxPointX = x \ 16
- ttxPointY = Y \ 16
- GraphDraw
- End Sub
- ' ##################################################################### '
- ' # * ПРОЧИЕ ФУНКЦИИ ДЛЯ ОСТАЛЬНЫХ ЭЛЕМЕНТОВ ПРОГРАММЫ * # '
- ' ##################################################################### '
- ' Главные кнопки управления
- Private Sub btnControls_Click(Index As Integer)
- Select Case Index
- Case 1 ' Компиляция
- ShellExecute Me.hWnd, vbNullString, _
- App.path & "\SourceCode\build.bat", vbNullString, App.path & "\SourceCode", _
- SW_SHOWNORMAL
- Case 0 ' Сохранить
- SaveData
- Case 2 ' Справка
- ShellExecute Me.hWnd, vbNullString, _
- App.path & "\Help\Index.htm", vbNullString, App.path, SW_SHOWNORMAL
- End Select
- End Sub
- ' Чекбоксы на вкладке Параметры
- Private Sub chkOption_Click(Index As Integer)
- Dim i%, boolEnabled As Boolean
- boolEnabled = IIf(chkOption(Index).Value, 0, 1)
- Select Case Index
- Case 1 ' Заблокировать Твикинг
- For i = 0 To 4: chkSonic(i).Enabled = boolEnabled: Next
- For i = 0 To 5
- vsBoss(i).Enabled = boolEnabled
- txtBoss(i).Enabled = boolEnabled
- Next i
- Case 2 ' Заблокировать Тексты -> Названия зон
- For i = 0 To 8: txtZone(i).Enabled = boolEnabled: Next
- For i = 0 To 1: chkZoneAct(i).Enabled = boolEnabled: Next
- End Select
- End Sub
- ' Обновляет список порядка уровней (при загрузке и при изменении имен зон)
- Sub UpdateLevelList()
- Dim ArrStr(6) As String, tmpOut$, i%, intData%
- ArrStr(0) = "GHZ": ArrStr(1) = "LZ": ArrStr(2) = "MZ"
- ArrStr(3) = "SLZ": ArrStr(4) = "SYZ": ArrStr(5) = "SBZ"
- ArrStr(6) = "FZ"
- For i = 0 To 19
- intData = lstLvlOrder.ItemData(i)
- If intData = &H80 Then
- tmpOut = "----------------------------"
- Else
- tmpOut = "[" & ArrStr(intData \ 3)
- If intData <> 18 Then tmpOut = tmpOut & CStr(intData Mod 3 + 1)
- tmpOut = tmpOut & IIf(Len(ArrStr(intData \ 3)) = 3, "] ", "] ")
- If intData = 18 Then tmpOut = tmpOut & " "
- tmpOut = tmpOut & txtZone(intData \ 3) & " ZONE" & _
- IIf(intData <> 18, " act " & (intData Mod 3) + 1, "")
- End If
- lstLvlOrder.List(i) = tmpOut
- Next
- lstLvlOrder.ListIndex = 0
- End Sub
- ' Кнопки Вверх/Вниз во вкладке Порядок уровней
- Private Sub cmdOrder_Click(Index As Integer)
- Dim tmpStr$, intAct%
- intAct = IIf(Index = 0, -1, 1)
- With lstLvlOrder
- If intAct = -1 And .ListIndex <= 1 Then Exit Sub
- If intAct = 1 And (.ListIndex = 19 Or .ListIndex = 0) Then Exit Sub
- tmpStr = .List(lstLvlOrder.ListIndex)
- .List(.ListIndex) = .List(.ListIndex + intAct)
- .List(.ListIndex + intAct) = tmpStr
- tmpStr = .ItemData(lstLvlOrder.ListIndex)
- .ItemData(.ListIndex) = .ItemData(.ListIndex + intAct)
- .ItemData(.ListIndex + intAct) = tmpStr
- .ListIndex = .ListIndex + intAct
- End With
- UpdateOrderStatus
- End Sub
- Sub UpdateOrderStatus()
- Dim EnableFlag As Byte
- Select Case lstLvlOrder.ListIndex
- Case 0: EnableFlag = 0
- Case 1: EnableFlag = 1
- Case 19: EnableFlag = 10
- Case Else: EnableFlag = 11
- End Select
- cmdOrder(0).Enabled = EnableFlag \ 10
- cmdOrder(1).Enabled = EnableFlag Mod 10
- End Sub
- Private Sub lstLvlOrder_Click()
- UpdateOrderStatus
- End Sub
- ' Открывает ссылки
- Private Sub lbl_Click(Index As Integer)
- If Index = 21 Or Index = 62 Then _
- ShellExecute Me.hWnd, vbNullString, lbl(Index).Caption, _
- vbNullString, "C:\", SW_SHOWNORMAL
- End Sub
- ' Запускает одну из доступных утилит
- Private Sub cmdUtil_Click(Index As Integer)
- Select Case Index
- Case 0 ' SonED2
- ShellExecute Me.hWnd, vbNullString, App.path & "\SonED2\SonED2.exe", _
- vbNullString, App.path & "\SonED2\", SW_SHOWNORMAL
- Case 1 ' SonMapEd
- ShellExecute Me.hWnd, vbNullString, App.path & "\SonMapEd\SonMapEd.exe", _
- vbNullString, App.path & "\SonMapEd\", SW_SHOWNORMAL
- Case 2 ' Porter
- Shell App.path & "\Porter\Porter.exe", vbNormalFocus
- Case 3 ' Creditor
- Shell App.path & "\Creditor\Creditor.exe", vbNormalFocus
- Case 4 ' Sonic1.asm
- ShellExecute Me.hWnd, vbNullString, App.path & "\SourceCode\sonic1.asm", _
- vbNullString, App.path & "\SourceCode\", SW_SHOWNORMAL
- End Select
- End Sub
- ' Обрабатывает вводимые символы для названий зон
- Private Sub txtZone_KeyPress(Index As Integer, KeyAscii As Integer)
- KeyAscii = Asc(UCase(Chr(KeyAscii)))
- If (KeyAscii < Asc("A") Or KeyAscii > Asc("Z")) _
- And KeyAscii <> 8 And KeyAscii <> 32 Then
- KeyAscii = 0
- ElseIf Chr(KeyAscii) = "W" Or Chr(KeyAscii) = "X" Or Chr(KeyAscii) = "Q" _
- Or Chr(KeyAscii) = "J" Or Chr(KeyAscii) = "V" Then
- KeyAscii = 0
- End If
- End Sub
- Private Sub txtZone_LostFocus(Index As Integer)
- UpdateLevelList
- End Sub
- ' Открывает диалог для выбора локации РОМа
- Private Sub btnBrowse_Click()
- Dim cmdlg As New cls_dlg
- With cmdlg
- .DialogTitle = "Куда сохранять будем..."
- .flags = cdlOFNExplorer
- .Filter = "РОМ Первого Соника (*.bin)|*.bin|Любой файлик|*"
- Me.Enabled = False
- .ShowSave
- Me.Enabled = True
- If .FileName = "" Then Exit Sub
- txtCompPath = .FileName
- .FileName = "": .Filter = "": .flags = 0: .DialogTitle = ""
- End With
- Set cmdlg = Nothing
- End Sub
- ' Изменение списка песен в зависимости от выбранной группы
- Private Sub cmbMusGroup_Click(Index As Integer)
- cmbMusGroup_Change Index
- End Sub
- Private Sub cmbMusGroup_Change(Index As Integer)
- On Error Resume Next
- Dim FileName As String, arr() As String
- cmbMusList(Index).Clear ' Очищаем список текущих песен
- FileName = Dir(App.path & "\Music\", vbNormal)
- Do While FileName <> ""
- arr() = Split(Replace(FileName, "_", " ", , 1), " ")
- If arr(0) = cmbMusGroup(Index) Then _
- cmbMusList(Index).AddItem Replace(arr(1), "_", " ")
- FileName = Dir()
- Loop
- If cmbMusList(Index).ListCount > 0 Then cmbMusList(Index).ListIndex = 0
- End Sub
- ' Контролы менеджера песенок
- Private Sub lstManagerGroup_Click()
- On Error Resume Next
- Dim FileName As String, arr() As String
- lstManagerSong.Clear ' Очищаем список текущих песен
- FileName = Dir(App.path & "\Music\", vbNormal)
- Do While FileName <> ""
- arr() = Split(Replace(FileName, "_", " ", , 1), " ")
- If UCase(arr(0)) = UCase(lstManagerGroup) Then _
- lstManagerSong.AddItem Replace(arr(1), "_", " ")
- FileName = Dir()
- Loop
- If lstManagerSong.ListCount > 0 Then lstManagerSong.ListIndex = 0
- End Sub
- ' Команды для менеджера
- Private Sub cmdManager_Click(Index As Integer)
- Dim strIn$, i%, intRem%
- Select Case Index
- Case 0 ' Добавить группу
- strIn = InputBox("Введите имя группы: ")
- If strIn = "" Then Exit Sub
- For i = 0 To lstManagerGroup.ListCount - 1
- If lstManagerGroup.List(i) = strIn Then ' Нет ли уже такой группы?
- MsgBox "Такая группа уже есть.", vbExclamation
- Exit Sub
- End If
- Next i
- lstManagerGroup.AddItem strIn
- lstManagerGroup.ListIndex = lstManagerGroup.ListCount - 1
- For i = 0 To cmbMusGroup.UBound: cmbMusGroup(i).AddItem strIn: Next
- Case 1 ' Удалить группу
- intRem = lstManagerGroup.ListIndex
- If intRem < 3 Then
- MsgBox "Нельзя удалить священную группу!", vbCritical
- Exit Sub
- End If
- lstManagerGroup.RemoveItem intRem
- For i = 0 To cmbMusGroup.UBound
- If cmbMusGroup(i).ListIndex = intRem Then cmbMusGroup(i).ListIndex = intRem - 1
- cmbMusGroup(i).RemoveItem intRem
- Next
- lstManagerGroup.ListIndex = intRem - 1
- GoTo UpdateListFile
- Case 2 ' Добавить песню
- Dim cmdlg As New cls_dlg
- With cmdlg
- .DialogTitle = "Куда сохранять будем..."
- .flags = cdlOFNExplorer Or cdlOFNHideReadOnly
- .Filter = "SMPS-музыка (*.bin)|*.bin|Любой файлик|*"
- Me.Enabled = False
- .ShowOpen
- Me.Enabled = True
- If .FileName = "" Or Dir(.FileName) = "" Then Exit Sub
- strIn = .FileName
- .FileName = "": .Filter = "": .flags = 0: .DialogTitle = ""
- End With
- Set cmdlg = Nothing
- Dim strOut$: strOut = Replace(strIn, ".bin", "")
- For i = 0 To Len(strOut) - 1
- If Mid(strOut, Len(strOut) - i, 1) = "\" Then
- strOut = Mid(strOut, Len(strOut) - i + 1, Len(strOut))
- Exit For
- End If
- Next i
- strOut = InputBox("Введите имя песни: ", , strOut)
- If strOut = "" Then Exit Sub
- FileCopy strIn, App.path & "\Music\" & lstManagerGroup & _
- "_" & Replace(strOut, " ", "_")
- lstManagerGroup_Click ' Обновить список песен
- GoTo UpdateListFile
- Case 3 ' Удалить песню
- If lstManagerSong.ListIndex < 0 Then Exit Sub
- If MsgBox("Удалить " & lstManagerSong & "?", vbQuestion Or vbYesNo) = vbNo Then: _
- Exit Sub
- Kill App.path & "\Music\" & lstManagerGroup & _
- "_" & Replace(lstManagerSong, " ", "_")
- lstManagerGroup_Click ' Обновить список песен
- End Select
- UpdateListFile:
- Dim F%: F = FreeFile
- Open App.path & "\Data\musiclist.dat" For Output As #F
- For i = 0 To lstManagerGroup.ListCount - 1
- Print #F, lstManagerGroup.List(i) & _
- IIf(i = lstManagerGroup.ListCount - 1, "", vbCrLf);
- Next i
- Close #F
- End Sub
- ' Количество ударов у босса
- Private Sub vsBoss_Change(Index As Integer)
- txtBoss(Index) = Abs(vsBoss(Index).Value)
- End Sub
- ' Флажок для включения замены арта
- Private Sub chkArt_Click(Index As Integer)
- Dim boolEnabled As Boolean, i%
- boolEnabled = IIf(chkArt(Index).Value, 1, 0)
- Select Case Index
- Case 0 ' Monitors
- For i = 0 To optArtMon.UBound: optArtMon(i).Enabled = boolEnabled: Next i
- Case 1 ' HUD
- For i = 0 To optArtHUD.UBound: optArtHUD(i).Enabled = boolEnabled: Next i
- End Select
- End Sub
- ' Нажатие на лого (пасхалочка ^_^)
- Private Sub imgLogo_Click(Index As Integer)
- imgLogo(1).Visible = Not imgLogo(1).Visible
- End Sub
Add Comment
Please, Sign In to add comment