Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_ch5_LW20W_handoff_Step_2

(view raw script w/o annotations or w/e)
1
var cam = scr_getcam();
2
if (handoff == 0)
3
{
4
    handoff = 1;
5
    snd_free_all();
6
    var camx = 220;
7
    if (instance_exists(obj_ch5_LW20W))
8
    {
9
        var no = -4;
10
        with (obj_actor)
11
        {
12
            if (name == "noelle")
13
                no = id;
14
        }
15
        actor = 
scr_marker_frominstance
scr_marker_frominstance

function
scr_marker_frominstance(arg0 = id, arg1 = false)
{ var obj = 1238; if (arg1) obj = 1496; var _marker = instance_create(arg0.x, arg0.y, obj); _marker.sprite_index = arg0.sprite_index; _marker.image_alpha = arg0.image_alpha; _marker.image_angle = arg0.image_angle; _marker.image_blend = arg0.image_blend; _marker.image_index = arg0.image_index; _marker.image_speed = arg0.image_speed; _marker.image_xscale = arg0.image_xscale; _marker.image_yscale = arg0.image_yscale; _marker.mask_index = arg0.mask_index; _marker.depth = arg0.depth; return _marker; } function scr_fog_marker_frominstance(arg0 = id, arg1 = 32768) { var _marker = instance_create(arg0.x, arg0.y, obj_marker_fog); _marker.sprite_index = arg0.sprite_index; _marker.image_alpha = arg0.image_alpha; _marker.image_angle = arg0.image_angle; _marker.image_blend = arg0.image_blend; _marker.image_index = arg0.image_index; _marker.image_speed = arg0.image_speed; _marker.image_xscale = arg0.image_xscale; _marker.image_yscale = arg0.image_yscale; _marker.mask_index = arg0.mask_index; _marker.depth = arg0.depth; _marker.color = arg1; return _marker; } function scr_blend_marker_frominstance(arg0 = id, arg1 = 1) { var _marker = instance_create(arg0.x, arg0.y, obj_marker_blend); _marker.sprite_index = arg0.sprite_index; _marker.image_alpha = arg0.image_alpha; _marker.image_angle = arg0.image_angle; _marker.image_blend = arg0.image_blend; _marker.image_index = arg0.image_index; _marker.image_speed = arg0.image_speed; _marker.image_xscale = arg0.image_xscale; _marker.image_yscale = arg0.image_yscale; _marker.mask_index = arg0.mask_index; _marker.depth = arg0.depth; _marker.blend = arg1; return _marker; } function scr_fogblend_marker_frominstance(arg0 = id, arg1 = 1, arg2 = 32768) { var _marker = instance_create(arg0.x, arg0.y, obj_marker_fogblend); _marker.sprite_index = arg0.sprite_index; _marker.image_alpha = arg0.image_alpha; _marker.image_angle = arg0.image_angle; _marker.image_blend = arg0.image_blend; _marker.image_index = arg0.image_index; _marker.image_speed = arg0.image_speed; _marker.image_xscale = arg0.image_xscale; _marker.image_yscale = arg0.image_yscale; _marker.mask_index = arg0.mask_index; _marker.depth = arg0.depth; _marker.blend = arg1; _marker.color = arg2; return _marker; }
(no);
16
        with (obj_actor)
17
            visible = false;
18
        with (obj_ch5_LW20W)
19
        {
20
            _shadow_kris.visible = false;
21
            _shadow_noelle.visible = false;
22
        }
23
        with (obj_stickto)
24
            instance_destroy();
25
    }
26
    else
27
    {
28
        with (obj_mainchara)
29
            cutscene = true;
30
        global.interact = 1;
31
        actor = 
scr_marker_ext
scr_marker_ext

function
scr_marker_ext(arg0, arg1, arg2, arg3 = 1, arg4 = 1, arg5 = 0, arg6 = 0, arg7 = 16777215, arg8 = depth, arg9 = false, arg10 = -1, arg11 = 1, arg12 = false)
{ var objinst = 1238; if (arg12) objinst = 1496; var thismarker = instance_create(arg0, arg1, objinst); with (thismarker) { depth = arg8; sprite_index = arg2; image_speed = arg5; image_xscale = arg3; image_yscale = arg4; image_index = arg6; image_blend = arg7; image_alpha = arg11; if (arg9)
scr_depth_alt();
} if (arg10 > 0)
scr_doom(thismarker, arg10);
return thismarker; } function scr_marker_fromasset(arg0, arg1 = depth, arg2 = false, arg3 = false) { if (is_undefined(arg0)) { debug_message("Warning: scr_marker_fromasset() sprite_instance didn't exist"); return -4; } var sprite = layer_sprite_get_sprite(arg0); var index = layer_sprite_get_index(arg0); var imagespeed = layer_sprite_get_speed(arg0); var xscale = layer_sprite_get_xscale(arg0); var yscale = layer_sprite_get_yscale(arg0); var angle = layer_sprite_get_angle(arg0); var blend = layer_sprite_get_blend(arg0); var alpha = layer_sprite_get_alpha(arg0); var xloc = layer_sprite_get_x(arg0); var yloc = layer_sprite_get_y(arg0); var markertype = 1238; if (arg3) markertype = 1496; var thismarker = instance_create_depth(xloc, yloc, arg1, markertype); with (thismarker) { sprite_index = sprite; image_index = index; image_speed = imagespeed; image_xscale = xscale; image_yscale = yscale; image_angle = angle; image_blend = blend; image_alpha = alpha; if (arg2)
scr_depth_alt(id, arg2);
} return thismarker; } function scr_assetgetinfo(arg0) { var sprite = layer_sprite_get_sprite(arg0); var index = layer_sprite_get_index(arg0); var xloc = layer_sprite_get_x(arg0); var yloc = layer_sprite_get_y(arg0); var xscale = layer_sprite_get_xscale(arg0); var yscale = layer_sprite_get_yscale(arg0); var angle = layer_sprite_get_angle(arg0); var blend = layer_sprite_get_blend(arg0); var alpha = layer_sprite_get_alpha(arg0); var imagespeed = layer_sprite_get_speed(arg0); return [sprite, index, xloc, yloc, xscale, yscale, angle, blend, alpha, imagespeed]; }
(370, 98, spr_kris_noelle_beach_walk_silo, 1, 1, 0, undefined, c_white, 98560);
32
    }
33
    with (actor)
34
    {
35
        camxoff = x - camx;
36
        camera_setxy(round(x - camxoff));
37
    }
38
    with (obj_ch5_LW20W_blur)
39
        instance_destroy();
40
}
41
with (bgwhite)
42
    x = cam.x - 5;
43
with (failwhite)
44
    x = cam.x - 5;
45
var _prog = wprog(22, 23) * 0.5;
46
if (textind > 23)
47
    _prog = (wprog(23, 28) * 0.5) + 0.5;
48
if (textind > 28)
49
    _prog = 1 - wprog(28, 44);
50
c_border = merge_color(c_white, c_red, _prog);
51
_prog = wprog(28, 44);
52
c_inner = merge_color(c_black, c_white, _prog);
53
highlightCol = merge_color(c_yellow, c_white, _prog);
54
_prog = wprog(44, 70) * 0.9;
55
heartCol = merge_color(c_red, c_white, _prog);
56
_prog = wprog(19, 28);
57
with (bgwhite)
58
    image_alpha = lerp(image_alpha, _prog, 1/120);
59
var failprog = 0;
60
if (textind >= drownindex && !failed)
61
{
62
    faillimit = 450;
63
    if (textind > 22)
64
        faillimit = lerp(150, 30, wprog(23, 40));
65
    if (textind == 35 || textind == 29 || textind == 24 || textind == 17 || textind == 15)
66
        faillimit += 45;
67
    var canfail = false;
68
    if (instance_exists(obj_writer))
69
        canfail = true;
70
    if (i_ex(obj_choicer_neo))
71
        canfail = true;
72
    if (canfail == true)
73
    {
74
        failtimer++;
75
        if (failtimer >= faillimit && !failed)
76
        {
77
            k_d();
78
            con = 99;
79
            timer = 0;
80
            failed = 1;
81
        }
82
    }
83
    else
84
    {
85
        failtimer = 0;
86
    }
87
    var prog = failtimer / (faillimit * 0.4);
88
    failprog = prog;
89
    with (failwhite)
90
    {
91
        if (!other.failed)
92
        {
93
            if (image_alpha < prog)
94
                image_alpha = lerp(image_alpha, prog, 1/30);
95
            else
96
                image_alpha = lerp(image_alpha, prog, 1/30);
97
        }
98
    }
99
}
100
_prog = wprog(14, 40);
101
_prog = 0;
102
var high = 1453;
103
var low = 940;
104
with (obj_ch5_LW20W_submerge)
105
{
106
    if ((high - low) != 0)
107
        _prog = (x - low) / (high - low);
108
}
109
blurstrength = lerp(blurstrength, _prog, 0.016666666666666666);
110
_prog = blurstrength;
111
with (obj_ch5_LW20W_blur2)
112
{
113
    if (_prog > 0)
114
    {
115
        ind = _prog;
116
        visible = true;
117
        baseblur = lerp_out_cubic(0, 3, _prog) + failprog;
118
        blurstrength = lerp(1, 2, _prog);
119
    }
120
}
121
if (musicstart)
122
{
123
    var maxvol = 3;
124
    var notextpostdrown = 17;
125
    var horriblesound = 30;
126
    var basePitch = 0.4;
127
    var lowMod = 0.98;
128
    var higMod = 1.05;
129
    var targpitch = wprog(0, drownindex) * basePitch;
130
    if (bgm_submerge && textind < notextpostdrown)
131
    {
132
        _bgm_pitch = basePitch;
133
        targpitch = _bgm_pitch;
134
    }
135
    if (textind >= notextpostdrown && textind < horriblesound)
136
    {
137
        _bgm_pitch = basePitch * power(lowMod, textind - (notextpostdrown - 1));
138
        targpitch = _bgm_pitch;
139
    }
140
    if (textind >= horriblesound)
141
    {
142
        var _lowest_pitch = basePitch * power(lowMod, horriblesound - 1 - (notextpostdrown - 1));
143
        _bgm_pitch = _lowest_pitch * power(higMod, textind - (horriblesound - 1));
144
    }
145
    _bgm_pitch = lerp(_bgm_pitch, targpitch, 0.025);
146
    var targvol = lerp(0, 0.2 * maxvol, scr_xprog(textind, 0, drownindex, true));
147
    if (bgm_submerge)
148
        targvol = maxvol;
149
    if (textind >= (endind - 20))
150
        targvol = lerp(maxvol, 0, scr_xprog(textind, endind - 19, endind, true));
151
    if (failed)
152
        targvol = -1;
153
    _bgm_volume = lerp(_bgm_volume, targvol, 1/30);
154
    if (!failed && bgm_submerge == false)
155
    {
156
        if (obj_ch5_LW20W_submerge.submerged)
157
        {
158
            _bgm_volume = maxvol;
159
            _bgm_pitch = 0.4;
160
            bgm_submerge = true;
161
        }
162
    }
163
    audio_sound_pitch(_bgm_track[1], _bgm_pitch);
164
    audio_sound_gain(_bgm_track[1], _bgm_volume, 0);
165
}
166
var dampen = 1 - (wprog(20, endind) * 0.9);
167
if (textind >= drownindex && con < 95 && !failed)
168
{
169
    _prog = wprog(drownindex - 1, endind - 20);
170
    hurtsoundreset = round(lerp(60, 2, _prog));
171
    var hurtsndvol = lerp(0.5, 1, wprog(drownindex - 1, 44)) * dampen;
172
    hurtsoundtimer++;
173
    if (textind >= 28)
174
    {
175
        var h2 = round(hurtsoundtimer + (hurtsoundreset / 2));
176
        h2 = 
scr_wrap
scr_wrap

function
scr_wrap(arg0, arg1, arg2)
{ if ((arg0 % 1) == 0) { while (arg0 > arg2 || arg0 < arg1) { if (arg0 > arg2) { arg0 = (arg1 + arg0) - arg2 - 1; } else if (arg0 < arg1) { arg0 = ((arg2 + arg0) - arg1) + 1; } else { } } return arg0; } else { var _old = argument[0] + 1; while (arg0 != _old) { _old = arg0; if (arg0 < arg1) { arg0 = arg2 - (arg1 - arg0); } else if (arg0 > arg2) { arg0 = arg1 + (arg0 - arg2); } else { } } return arg0; } }
(h2, 0, hurtsoundreset);
177
        if (h2 == hurtsoundreset)
178
        {
179
            var hurtsndvol2 = lerp(0.3, 0.8, wprog(28, 44)) * dampen;
180
            hurtsound2 = snd_play(snd_hurt_muffled_2x, hurtsndvol2);
181
        }
182
        hurtsoundtimer2++;
183
        if ((hurtsoundtimer2 % 2) == 0)
184
        {
185
            low = lerp(0.9, 0.3, _prog);
186
            high = lerp(1, 1.2, _prog);
187
            snd_pitch(hurtsound2, random_range(low, high));
188
        }
189
    }
190
    if (hurtsoundtimer >= hurtsoundreset)
191
    {
192
        
scr_shakescreen
scr_shakescreen

function
scr_shakescreen(arg0 = 4)
{ with (instance_create(x, y, obj_shake)) { shakex = arg0; shakey = arg0; } }
();
193
        hurtsoundtimer = 0;
194
        hurtsound = snd_play(snd_hurt_muffled_2x, hurtsndvol);
195
    }
196
}
197
if (staticinit == 0 && textind >= drownindex)
198
{
199
    staticinit = 1;
200
    staticsnd = snd_loop(snd_static_loop);
201
}
202
if (staticinit == 1)
203
{
204
    var maxpitch = lerp(0.7, 0.4, wprog(drownindex, endind));
205
    var prog = failtimer / (faillimit * 0.4);
206
    var pitchtarg = lerp_out_cubic(0.2, 0.7, prog);
207
    var voltarg = lerp_out_quint(0, 0.7, prog);
208
    staticpitch = lerp(staticpitch, pitchtarg, 0.125);
209
    staticvol = lerp(staticvol, voltarg, 0.1);
210
    snd_volume(staticsnd, staticvol, 0);
211
    snd_pitch(staticsnd, staticpitch);
212
}
213
if (!failed)
214
{
215
    var _shake = 0;
216
    if (textind >= 14)
217
        _shake = lerp(0.26, 3, scr_xprog(textind, 14, 34, true));
218
    with (obj_writer)
219
        shake = _shake;
220
}
221
lowpitch = lerp(1, 0.8, scr_xprog(textind, 14, 34, true));
222
highpitch = lerp(1, 0.98, scr_xprog(textind, 14, 34, true));
223
with (obj_dialoguer)
224
{
225
    c_border = other.c_border;
226
    c_inner = other.c_inner;
227
}
228
with (obj_writer_stay)
229
{
230
    c_border = other.c_border;
231
    c_inner = other.c_inner;
232
}
233
with (obj_choicer_neo)
234
{
235
    heartCol = other.heartCol;
236
    highlightCol = other.highlightCol;
237
}
238
if (actorhandoff == 0)
239
{
240
    if (actor.sprite_index == spr_noelle_kris_pull_walk_water)
241
    {
242
        actor.image_alpha = 0;
243
        submergeactor.image_alpha = 1;
244
        actorhandoff = 1;
245
    }
246
}
247
with (obj_ch5_LW20W_submerge)
248
{
249
    x = other.actor.x;
250
    y = other.actor.y;
251
    depth = other.actor.depth - 1;
252
    animindex = other.actor.image_index;
253
}