CLEO работа со звуком

Lobber

Известный
Автор темы
178
57
Доброго времени суток всем, кто это читает. Я не так часто сюда пишу, ибо в большинстве случаев могу найти ошибку сам, но тут полный бред

Суть проблемы - есть клео черти знает каких годов,написанное под SA. Это mp3 плеер, который я с горем пополам адаптировал для работы в сампе. Но каждый раз после начала воспроизведения первого трека тебе делают -уши, ибо громкость по дефолту вывинчена на максималку. Задался целью сделать громкость на старте 0.1, как видно безрезультатно. Немного покопал код, смог настроить громкость при переключении треков, но при первом старте никак не выходит. Что я только не колхозил, 0 эмоций.

Для того человека, который возьмется этот код копать, расскажу какие клавиши за что отвечают

0x25 - предыдущий трек // стрелка лево
0x26 - как я понял сброс всего трека, громкости, номера трека // стрелка вверх
0x27 - следующий трек // стрелка право
0x28 - старт/пауза. Ничего больше не делает // стрелка вниз
После переключения трека нужно еще раз жать стрелку вниз.

Если у кого то есть мысли, что нужно сделать, скину дополнительно TXD файлы, чтоб скрипт смог запуститься в игре для тестов


CLEO:
// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
thread 'MP3P'
0ADF: add_dynamic_GXT_entry "_MP3PF_" text "Faixa ~1~"
0@ = 1
30@ = 1
2@ = 0
4@ = 0.0
20@ = 585.0
5@ = 60.0

:MP3P_84
wait 0
if
Player.Defined($PLAYER_CHAR)
else_jump @MP3P_126
if and
key_down 16
key_down 79
else_jump @MP3P_2168
jump @MP3P_145

:MP3P_126
Audiostream.Release(3@)
2@ = 0
jump @MP3P_84

:MP3P_145
wait 0
if
call @MP3P_2937 0
else_jump @MP3P_84
0390: load_txd_dictionary 'MP3P'
038F: load_texture "player" as 1 // Load dictionary with 0390 first
038F: load_texture "volume" as 2 // Load dictionary with 0390 first
038F: load_texture "vicon" as 3 // Load dictionary with 0390 first
gosub @MP3P_2430

:MP3P_223
wait 0
0085: 23@ = 30@ // (int)
03F0: enable_text_draw 0
wait 0
045A: draw_text_1number 558.0 325.0 GXT '_MP3PF_' number 23@
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 1 position 580.0 378.0 size 176.0 176.0 RGBA 255 255 255 255
038D: draw_texture 2 position 20@ 360.0 size 5@ 6.0 RGBA 255 255 255 255
038D: draw_texture 3 position 548.0 360.0 size 10.0 10.0 RGBA 255 255 255 255
if
   Player.Defined($PLAYER_CHAR)
else_jump @MP3P_398
jump @MP3P_432

:MP3P_398
if
   not 2@ == 0
else_jump @MP3P_421
Audiostream.Release(3@)

:MP3P_421
03F0: enable_text_draw 0
jump @MP3P_84

:MP3P_432
if and
key_down 16
key_down 79
else_jump @MP3P_476
wait 0
gosub @MP3P_2530
wait 100
0391: release_textures
wait 500
jump @MP3P_84

:MP3P_476
if
0AB0:   key_pressed 0xBB
else_jump @MP3P_595
if
  2@ == 0
else_jump @MP3P_516
jump @MP3P_223

:MP3P_516
wait 0
4@ = Audiostream.Volume(3@)
4@ += 0.1
if
  4@ == 1.1
else_jump @MP3P_576
4@ = 1.0
jump @MP3P_595

:MP3P_576
wait 0
Audiostream.Volume(3@) = 4@
gosub @MP3P_2630

:MP3P_595
if
0AB0:   key_pressed 0xBD
else_jump @MP3P_718
if
  2@ == 0
else_jump @MP3P_635
jump @MP3P_223

:MP3P_635
wait 0
4@ = Audiostream.Volume(3@)
4@ -= 0.1
wait 0
if
  4@ == 0.0
else_jump @MP3P_699
4@ = 0.1
jump @MP3P_718

:MP3P_699
wait 0
Audiostream.Volume(3@) = 4@
gosub @MP3P_2630

:MP3P_718
045A: draw_text_1number 558.0 325.0 GXT '_MP3PF_' number 23@
if
0AB0:   key_pressed 0x25
else_jump @MP3P_999
wait 100
041E:   set_radio_station 12
wait 100
30@ -= 1
if
  30@ == 0
else_jump @MP3P_999
30@ = 1
31@ = 2
0ACA: show_text_box "Processando..."

:MP3P_818
wait 0
17@ = File.Open("MP3/InGame.ini", "wt+")
0AD9: write_formatted_text "MP3/%d.mp3" in_file 17@ 31@
File.Close(17@)
17@ = File.Open("MP3/InGame.ini", "rt+")
File.ReadString(17@, 13@v, 15)
File.Close(17@)
if
0AAB:   file_exists 13@v
else_jump @MP3P_963
wait 0
31@ += 1
30@ += 1
jump @MP3P_992
jump @MP3P_992

:MP3P_963
wait 0
0B00: delete_file "MP3/InGame.ini" // IF and SET
jump @MP3P_999

:MP3P_992
jump @MP3P_818

:MP3P_999
if
0AB0:   key_pressed 0x27
else_jump @MP3P_1186
wait 100
041E:   set_radio_station 12
wait 100
0085: 31@ = 30@ // (int)
31@ += 1
17@ = File.Open("MP3/InGame.ini", "wt+")
0AD9: write_formatted_text "MP3/%d.mp3" in_file 17@ 31@
File.Close(17@)
17@ = File.Open("MP3/InGame.ini", "rt+")
File.ReadString(17@, 13@v, 15)
File.Close(17@)
0B00: delete_file "MP3/InGame.ini" // IF and SET
if
0AAB:   file_exists 13@v
else_jump @MP3P_1175
0085: 30@ = 31@ // (int)
jump @MP3P_1186

:MP3P_1175
wait 0
30@ = 1

:MP3P_1186
if
0AB0:   key_pressed 0x28
else_jump @MP3P_1778
wait 100
041E:   set_radio_station 12
wait 100
if
803B:   not  0@ == 30@ // (int)
else_jump @MP3P_1473
wait 0
if
   not 2@ == 0
else_jump @MP3P_1254
4@ = Audiostream.Volume(3@)
gosub @sound_down

:MP3P_1254
wait 0
Audiostream.Release(3@)
17@ = File.Open("MP3/InGame.ini", "wt+")
0AD9: write_formatted_text "MP3/%d.mp3" in_file 17@ 30@
File.Close(17@)
17@ = File.Open("MP3/InGame.ini", "rt+")
wait 0
File.ReadString(17@, 13@v, 15)
3@ = Audiostream.Load(13@v)
wait 100
if
   not 2@ == 0
else_jump @MP3P_1400
Audiostream.Volume(3@) = 4@
jump @MP3P_1424

:MP3P_1400
wait 0
20@ = 585.0
5@ = 60.0

:MP3P_1424
wait 0
Audiostream.PerformAction(3@, PLAY)
0AC0: audiostream 3@ loop 1
File.Close(17@)
0B00: delete_file "MP3/InGame.ini" // IF and SET
0085: 0@ = 30@ // (int)
2@ = 7

:MP3P_1473
wait 0
if
  2@ == 2
else_jump @MP3P_1509
Audiostream.PerformAction(3@, RESUME)
2@ = 3

:MP3P_1509
wait 0
if
  2@ == 1
else_jump @MP3P_1545
Audiostream.PerformAction(3@, PAUSE)
2@ = 2

:MP3P_1545
wait 0
if
  2@ == 0
else_jump @MP3P_1720
17@ = File.Open("MP3/InGame.ini", "wt+")
0AD9: write_formatted_text "MP3/%d.mp3" in_file 17@ 30@
File.Close(17@)
17@ = File.Open("MP3/InGame.ini", "rt+")
File.ReadString(17@, 13@v, 15)
3@ = Audiostream.Load(13@v)
20@ = 585.0
5@ = 60.0
Audiostream.PerformAction(3@, PLAY)
File.Close(17@)
0B00: delete_file "MP3/InGame.ini" // IF and SET
2@ = 1

:MP3P_1720
wait 0
if
  2@ == 3
else_jump @MP3P_1749
2@ = 1

:MP3P_1749
wait 0
if
  2@ == 7
else_jump @MP3P_1778
2@ = 1

:MP3P_1778
045A: draw_text_1number 558.0 325.0 GXT '_MP3PF_' number 23@
if
0AB0:   key_pressed 0x26
else_jump @MP3P_1853
wait 100
041E:   set_radio_station 12
wait 100
2@ = 0
20@ = 585.0
5@ = 60.0
Audiostream.Release(3@)

:MP3P_1853
if
key_down 116
else_jump @MP3P_1918
if
  2@ == 2
else_jump @MP3P_1918
Audiostream.Release(3@)
2@ = 0
20@ = 585.0
5@ = 60.0

:MP3P_1918
if
   not 2@ == 0
else_jump @MP3P_2161
3@ = Audiostream.State(19@)
if
  19@ == -1
else_jump @MP3P_2161
0@ += 1
Audiostream.Release(3@)
17@ = File.Open("MP3/InGame.ini", "wt+")
0AD9: write_formatted_text "MP3/%d.mp3" in_file 17@ 0@
File.Close(17@)
17@ = File.Open("MP3/InGame.ini", "rt+")
File.ReadString(17@, 13@v, 15)
File.Close(17@)
0B00: delete_file "MP3/InGame.ini" // IF and SET
if
0AAB:   file_exists 13@v
else_jump @MP3P_2138
3@ = Audiostream.Load(13@v)
Audiostream.Volume(3@) = 4@
Audiostream.PerformAction(3@, PLAY)
0AC0: audiostream 3@ loop 1
2@ = 1
jump @MP3P_2161

:MP3P_2138
wait 0
0@ -= 1
Audiostream.Release(3@)
2@ = 0

:MP3P_2161
jump @MP3P_223

:MP3P_2168
if
   not 2@ == 0
else_jump @MP3P_84
3@ = Audiostream.State(19@)
if
  19@ == -1
else_jump @MP3P_2419
0@ += 1
Audiostream.Release(3@)
17@ = File.Open("MP3/InGame.ini", "wt+")
0AD9: write_formatted_text "MP3/%d.mp3" in_file 17@ 0@
File.Close(17@)
17@ = File.Open("MP3/InGame.ini", "rt+")
File.ReadString(17@, 13@v, 15)
File.Close(17@)
0B00: delete_file "MP3/InGame.ini" // IF and SET
if
0AAB:   file_exists 13@v
else_jump @MP3P_2396
3@ = Audiostream.Load(13@v)
Audiostream.Volume(3@) = 4@
Audiostream.PerformAction(3@, PLAY)
0AC0: audiostream 3@ loop 1
003B:   30@ == 0@ // (int)
2@ = 1
jump @MP3P_2419

:MP3P_2396
wait 0
0@ -= 1
Audiostream.Release(3@)
2@ = 0

:MP3P_2419
wait 0
jump @MP3P_84

:MP3P_2430
wait 0
1@ = 500.0
wait 0

:MP3P_2448
  1@ >= 378.0
else_jump @MP3P_2528
wait 0
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 1 position 580.0 1@ size 176.0 176.0 RGBA 255 255 255 255
1@ -= 20.0
03F0: enable_text_draw 0
jump @MP3P_2448

:MP3P_2528
return

:MP3P_2530
wait 0
1@ = 378.0
wait 0

:MP3P_2548
   not 1@ > 520.0
else_jump @MP3P_2628
wait 0
03E3: set_texture_to_be_drawn_antialiased 1
038D: draw_texture 1 position 580.0 1@ size 176.0 176.0 RGBA 255 255 255 255
1@ += 20.0
03F0: enable_text_draw 0
jump @MP3P_2548

:MP3P_2628
return

:MP3P_2630
wait 0
gosub @MP3P_2750
008F: 5@ = integer 5@ to_float
wait 0
5@ *= 6.0
20@ = 585.0
21@ = 1.0
wait 0

:MP3P_2687
wait 0
if
0035:   18@ >= 21@ // (float)
else_jump @MP3P_2717
jump @MP3P_2748

:MP3P_2717
wait 0
20@ += 2.9
21@ -= 0.1
jump @MP3P_2687

:MP3P_2748
return

:MP3P_2750
wait 0
4@ = Audiostream.Volume(3@)
18@ = 0.1
5@ = 1
wait 0

:MP3P_2783
wait 0
if
8025:   not  4@ > 18@ // (float)
else_jump @MP3P_2813
jump @MP3P_2893

:MP3P_2813
5@ += 1
18@ += 0.1
if
  18@ == 1.1
else_jump @MP3P_2861
18@ = 0.1

:MP3P_2861
if
  5@ == 11
else_jump @MP3P_2886
5@ = 1

:MP3P_2886
jump @MP3P_2783

:MP3P_2893
return
wait 0
if
   not 2@ == 0
else_jump @MP3P_2922
Audiostream.Release(3@)
0AC0: audiostream 3@ loop 1

:MP3P_2922
03F0: enable_text_draw 0
wait 0
jump @MP3P_84

:MP3P_2937
wait 0
17@ = File.Open("MP3/InGame.ini", "wt+")
0AD9: write_formatted_text "MP3/%d.mp3" in_file 17@ 1
File.Close(17@)
17@ = File.Open("MP3/InGame.ini", "rt+")
File.ReadString(17@, 13@v, 15)
if
0AAB:   file_exists 13@v
else_jump @MP3P_3053
return_true
jump @MP3P_3091

:MP3P_3053
0ACE: show_formatted_text_box "Faixa 1 Nao Encontrada [%s ]" 13@v
return_false

:MP3P_3091
File.Close(17@)
0B00: delete_file "MP3/InGame.ini" // IF and SET
ret 0

:sound_down
wait 0
4@ = Audiostream.Volume(3@)
4@ = 0.1
return