Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_micmenu_Step_0

(view raw script w/o annotations or w/e)
1
buffer -= 1;
2
if (act == -1)
3
{
4
    var _up_pressed = 0;
5
    var _down_pressed = 0;
6
    if (up_h())
7
    {
8
        if (up_p())
9
            _up_pressed = true;
10
        hold_up += 1;
11
        if (hold_up > 8)
12
        {
13
            hold_up = 7;
14
            _up_pressed = 1;
15
        }
16
        if (_up_pressed)
17
        {
18
            current -= 1;
19
            if (current < 0)
20
                current = 2;
21
            snd_play(snd_menumove);
22
        }
23
    }
24
    else
25
    {
26
        hold_up = 0;
27
    }
28
    if (down_h())
29
    {
30
        if (down_p())
31
            _down_pressed = true;
32
        hold_down += 1;
33
        if (hold_down > 8)
34
        {
35
            hold_down = 7;
36
            _down_pressed = 1;
37
        }
38
        if (_down_pressed)
39
        {
40
            current += 1;
41
            if (current > 2)
42
                current = 0;
43
            snd_play(snd_menumove);
44
        }
45
    }
46
    else
47
    {
48
        hold_down = 0;
49
    }
50
    if (button1_p())
51
    {
52
        switch (current)
53
        {
54
            case 0:
55
                buffer = 1;
56
                act = 0;
57
                break;
58
            case 1:
59
                buffer = 1;
60
                act = 1;
61
                break;
62
            case 2:
63
                endme = 1;
64
                break;
65
        }
66
        snd_play(snd_select);
67
    }
68
    if (button2_p() && buffer < 0 && endme == 0)
69
        endme = 1;
70
    if (endme)
71
    {
72
        global.interact = 0;
73
        with (obj_mainchara)
74
            onebuffer = 3;
75
        instance_destroy();
76
    }
77
}
78
if (act == 0)
79
{
80
    var _up_pressed = 0;
81
    var _down_pressed = 0;
82
    if (up_h())
83
    {
84
        if (up_p())
85
            _up_pressed = true;
86
        hold_up += 1;
87
        if (hold_up > 8)
88
        {
89
            hold_up = 7;
90
            _up_pressed = 1;
91
        }
92
        if (_up_pressed)
93
        {
94
            current -= 1;
95
            if (current < 0)
96
                current = menu_max - 1;
97
            if (!is_pc || current != (menu_max - 2))
98
            {
99
                mic_reload = 20;
100
                alarm[0]
 = 1;
gml_Object_obj_micmenu_Alarm_0.gml

obj_mike_controller.microphone_volume = 0; microphone_volume = 0; if (current < (mic_max - 1)) { global.microphone = current; with (obj_mike_controller) mic_reset(); }
101
            }
102
            snd_play(snd_menumove);
103
        }
104
    }
105
    else
106
    {
107
        hold_up = 0;
108
    }
109
    if (down_h())
110
    {
111
        if (down_p())
112
            _down_pressed = true;
113
        hold_down += 1;
114
        if (hold_down > 8)
115
        {
116
            hold_down = 7;
117
            _down_pressed = 1;
118
        }
119
        if (_down_pressed)
120
        {
121
            current += 1;
122
            if (current == menu_max)
123
                current = 0;
124
            if (!is_pc || current != (menu_max - 2))
125
            {
126
                mic_reload = 20;
127
                alarm[0]
 = 1;
gml_Object_obj_micmenu_Alarm_0.gml

obj_mike_controller.microphone_volume = 0; microphone_volume = 0; if (current < (mic_max - 1)) { global.microphone = current; with (obj_mike_controller) mic_reset(); }
128
            }
129
            snd_play(snd_menumove);
130
        }
131
    }
132
    else
133
    {
134
        hold_down = 0;
135
    }
136
    if (button1_p() && buffer < 0)
137
    {
138
        if (current == (menu_max - 1))
139
        {
140
            act = -1;
141
            current = 0;
142
            global.microphone = selected;
143
            with (obj_mike_controller)
144
                mic_reset();
145
        }
146
        else if (current == (menu_max - 3) && is_pc)
147
        {
148
            buffer = 1;
149
            if (global.right_click_mic == 1)
150
                global.right_click_mic = 0;
151
            else
152
                global.right_click_mic = 1;
153
            if (mic_max == 2 && global.right_click_mic == 0)
154
                global.right_click_mic = 2;
155
        }
156
        else if (current == (menu_max - 2) && is_pc)
157
        {
158
            buffer = 1;
159
            if (global.right_click_mic == 2)
160
                global.right_click_mic = 0;
161
            else
162
                global.right_click_mic = 2;
163
            if (mic_max == 2 && global.right_click_mic == 0)
164
                global.right_click_mic = 1;
165
        }
166
        else
167
        {
168
            selected = current;
169
            global.right_click_mic = false;
170
        }
171
        snd_play(snd_select);
172
    }
173
    if (button2_p() && buffer < 0)
174
    {
175
        act = -1;
176
        current = 0;
177
    }
178
}
179
if (act == 1 && buffer < 0)
180
{
181
    if (button1_p())
182
    {
183
        snd_play(snd_select);
184
        buffer = 3;
185
        act = -1;
186
        current = 1;
187
    }
188
    if (button2_p() && buffer < 0)
189
    {
190
        act = -1;
191
        current = 0;
192
    }
193
    reload -= 1;
194
    if (reload < 0)
195
    {
196
        if (left_h())
197
        {
198
            reload = 2;
199
            global.mic_sensitivity = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(global.mic_sensitivity, 0.035, 0.1);
200
        }
201
        if (right_h())
202
        {
203
            reload = 2;
204
            global.mic_sensitivity = 
scr_approach
scr_approach

function
scr_approach(arg0, arg1, arg2)
{ if (arg0 < arg1) { arg0 += arg2; if (arg0 > arg1) return arg1; } else { arg0 -= arg2; if (arg0 < arg1) return arg1; } return arg0; }
(global.mic_sensitivity, 4, 0.1);
205
        }
206
    }
207
}