Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_dw_transition_Draw_0

(view raw script w/o annotations or w/e)
1
index += 1;
2
if (rect_draw == 1)
3
{
4
    rs += 1;
5
    for (var i = 0; i < rect_amount; i += 1)
6
    {
7
        rsize[i] += 0.25;
8
        if (quick_mode == 1)
9
            rsize[i] += 0.25;
10
        if (rsize[i] > 0)
11
        {
12
            r_darkest = 5 - (rsize[i] * 0.8);
13
            if (rs < 20)
14
                r_darkest *= (rs / 20);
15
            if (r_darkest < 0)
16
                r_darkest = 0;
17
            if (r_darkest > 1)
18
                r_darkest = 1;
19
            r_color = merge_color(c_black, c_white, r_darkest);
20
            draw_sprite_ext(spr_doorblack, 0, rx + camerax(), ry + cameray(), rw * rsize[i], rh * rsize[i], rsize[i], r_color, 1);
21
        }
22
    }
23
}
24
if (con == 8)
25
{
26
    mus_volume(global.currentsong[1], 0, 30);
27
    with (obj_mainchara)
28
        cutscene = 1;
29
    with (obj_kris_headobj)
30
    {
31
        follow = 0;
32
        depth = obj_dw_transition.depth - 10;
33
    }
34
    sus_draw = 1;
35
    sus_sprite = spr_susieu;
36
    sus_index = 0;
37
    kris_sprite = spr_krisu;
38
    kris_index = 0;
39
    sus_v = 1.2;
40
    if (quick_mode == 1)
41
        sus_v = 2;
42
    timer = 0;
43
    con = 9;
44
    doorblack = 0;
45
}
46
if (con == 9)
47
{
48
    timer += 1;
49
    if (quick_mode == 1 || skiprunback == 1)
50
    {
51
        if (timer < 40)
52
        {
53
            snd_free_all();
54
            if (skiprunback == 0)
55
            {
56
                snd_play(snd_locker);
57
                doorblack = 1;
58
            }
59
            sus_v = 6;
60
            sus_f = 0.4;
61
            timer = 45;
62
            kris_x -= 4;
63
            sus_sprite = spr_susieu_run;
64
            kris_sprite = spr_krisu_run;
65
        }
66
    }
67
    if (timer < 30)
68
        sus_index += 0.2;
69
    if (timer == 30)
70
    {
71
        snd_free_all();
72
        snd_play(snd_locker);
73
        with (obj_darkdoor)
74
            instance_destroy();
75
        doorblack = 1;
76
        sus_index = 0;
77
        sus_v = 0;
78
        kris_x -= 4;
79
        sus_sprite = spr_susieu_run;
80
        kris_sprite = spr_krisu_run;
81
    }
82
    if (timer == 60)
83
    {
84
        sus_sprite = spr_susieu_run;
85
        kris_sprite = spr_krisu_run;
86
        sus_v = -5;
87
        sus_f = 0;
88
    }
89
    if (timer > 60 && timer < 68)
90
    {
91
        kris_y -= 1;
92
        sus_index += 0.25;
93
    }
94
    if (timer == 68)
95
    {
96
        sus_f = 0.15;
97
        sus_v = -4;
98
        sus_y -= 2;
99
        sus_x -= 2;
100
        sus_sprite = spr_susie_lw_fall_u;
101
        kris_sprite = spr_krisu_fall_lw;
102
        con = 15;
103
        soundtimer = 0;
104
    }
105
    if (doorblack == 1)
106
    {
107
        draw_set_color(c_black);
108
        draw_rectangle(rx1 + camerax(), ry1 + cameray(), rx2 + camerax(), ry2 + cameray(), false);
109
    }
110
}
111
if (con == 15)
112
{
113
    rs = 0;
114
    rh = (ry2 - ry1) / 100;
115
    rw = (rx2 - rx1) / 100;
116
    rx = (rx1 + rx2) / 2;
117
    ry = (ry1 + ry2) / 2;
118
    for (var i = 0; i < 8; i += 1)
119
        rsize[i] = 1 + (i * -2);
120
    rect_amount = 6;
121
    rect_draw = 1;
122
    timer = 0;
123
    if (quick_mode == 1)
124
        rect_amount = 3;
125
    con = 16;
126
    soundtimer = 3;
127
    rectsound = 0;
128
}
129
if (con == 16)
130
{
131
    soundthreshold = 6;
132
    if (quick_mode == 1)
133
        soundthreshold = 3;
134
    soundtimer++;
135
    if (soundtimer >= soundthreshold && rectsound < rect_amount)
136
    {
137
        soundtimer = 0;
138
        snd_stop(snd_dtrans_square);
139
        snd_play(snd_dtrans_square);
140
        snd_volume(snd_dtrans_square, 0.5, 0);
141
        rectsound++;
142
    }
143
    sus_index += 0.25;
144
    if (sus_v >= 0)
145
    {
146
        sus_f = 0;
147
        sus_v += 0.005;
148
    }
149
    timer += 1;
150
    threshold = 80;
151
    if (quick_mode == 1)
152
        threshold = 30;
153
    if (timer >= threshold)
154
    {
155
        timer = 0;
156
        con = 17;
157
        sus_index = 0;
158
    }
159
}
160
if (con == 17)
161
{
162
    __background_set(e__BG.Visible, 0, 0);
163
    draw_rect = 0;
164
    linecon = 1;
165
    sus_x_current = sus_x;
166
    kris_x_current = kris_x;
167
    sus_sprite = spr_susie_lw_fall_turn;
168
    kris_sprite = spr_kris_fall_turnaround;
169
    con = 18;
170
    soundcon = 1;
171
    radius = 60;
172
}
173
if (soundcon == 1)
174
{
175
    dronesfx = snd_loop(snd_dtrans_drone);
176
    snd_volume(dronesfx, 0, 0);
177
    snd_volume(dronesfx, 0.5, 60);
178
    snd_pitch(dronesfx, 0.1);
179
    dronetimer = 0;
180
    soundcon = 2;
181
}
182
if (soundcon == 2)
183
{
184
    dronetimer++;
185
    if (quick_mode == 1)
186
        dronetimer++;
187
    dronepitch = dronetimer / 80;
188
    if (dronepitch >= 1)
189
    {
190
        dronepitch = 1;
191
        soundcon = 3;
192
    }
193
    snd_pitch(dronesfx, dronepitch);
194
}
195
if (con == 18)
196
{
197
    timer += 1;
198
    if (quick_mode == 1)
199
        timer += 1;
200
    sus_index = (timer / 36) * 5;
201
    sus_x = sus_x_current - (sin(degtorad(timer * 2.5)) * radius);
202
    if (kris_only == 0)
203
        kris_x = kris_x_current + (sin(degtorad(timer * 2.5)) * radius);
204
    if (timer >= 35)
205
    {
206
        sus_sprite = spr_susie_lw_fall_d;
207
        kris_sprite = spr_kris_fall_d_lw;
208
        sus_index = 0;
209
        con = 19;
210
        timer = 0;
211
    }
212
}
213
if (con == 19)
214
{
215
    sus_index += 0.2;
216
    timer += 1;
217
    if (quick_mode == 1)
218
        timer = 8;
219
    if (timer >= 8)
220
    {
221
        con = 30;
222
        timer = 0;
223
        sus_draw = 0;
224
    }
225
}
226
if (con == 30)
227
{
228
    if (kris_only == 0)
229
        draw_sprite_ext(spr_susie_lw_fall_d, index / 4, sus_x, sus_y, 1, 1, 0, c_white, 1);
230
    draw_sprite_ext(spr_kris_fall_d_lw, index / 4, kris_x, kris_y, 1, 1, 0, c_white, 1);
231
    timer += 1;
232
    if (quick_mode == 1)
233
        timer += 1;
234
    if (timer >= 15)
235
    {
236
        con = 31;
237
        timer = 0;
238
        sus_width = sprite_get_width(spr_susie_dw_fall_d);
239
        sus_height = sprite_get_height(spr_susie_dw_fall_d);
240
        sus_top = sus_height;
241
        kris_width = sprite_get_width(spr_kris_fall_d_dw);
242
        kris_height = sprite_get_height(spr_kris_fall_d_dw);
243
        kris_top = kris_height;
244
    }
245
}
246
if (con == 31)
247
{
248
    timer += 1;
249
    if (kris_only == 0)
250
        draw_sprite_part(spr_susie_lw_fall_d, index / 4, 0, 0, sus_width, sus_top, sus_x, sus_y);
251
    draw_sprite_part(spr_kris_fall_d_lw, index / 4, 0, 0, kris_width, kris_top, kris_x, kris_y);
252
    if (kris_only == 0)
253
        draw_sprite_part(spr_susie_dw_fall_d, index / 4, 0, sus_top, sus_width, sus_height - sus_top, sus_x, sus_y + sus_top);
254
    draw_sprite_part(spr_kris_fall_d_dw, index / 4, 0, kris_top, kris_width, kris_height - kris_top, kris_x, kris_y + kris_top);
255
    if (timer == 15)
256
    {
257
        with (obj_kris_headobj)
258
            breakcon = 1;
259
        if (room == room_library)
260
        {
261
            snd_play(snd_sparkle_glock);
262
            for (var i = 0; i < 1; i++)
263
            {
264
                sparkle[i] = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(kris_x + 15, kris_y + 15, spr_sparestar_anim);
265
                sparkle[i].image_speed = 0.5;
266
                sparkle[i].hspeed = random_range(-3, 3);
267
                sparkle[i].friction = 0.05;
268
                sparkle[i].gravity = -0.1;
269
            }
270
            
scr_keyitemremove
scr_keyitemremove

function
scr_keyitemremove(arg0)
{ removed = 0;
scr_keyitemcheck(arg0);
if (haveit == 1) { loc = 0; skip = 0; if (global.keyitem[0] == arg0 && skip == 0) { loc = 0; skip = 1; } if (global.keyitem[1] == arg0 && skip == 0) { loc = 1; skip = 1; } if (global.keyitem[2] == arg0 && skip == 0) { loc = 2; skip = 1; } if (global.keyitem[3] == arg0 && skip == 0) { loc = 3; skip = 1; } if (global.keyitem[4] == arg0 && skip == 0) { loc = 4; skip = 1; } if (global.keyitem[5] == arg0 && skip == 0) { loc = 5; skip = 1; } if (global.keyitem[6] == arg0 && skip == 0) { loc = 6; skip = 1; } if (global.keyitem[7] == arg0 && skip == 0) { loc = 7; skip = 1; } if (global.keyitem[8] == arg0 && skip == 0) { loc = 8; skip = 1; } if (global.keyitem[9] == arg0 && skip == 0) { loc = 9; skip = 1; } if (global.keyitem[10] == arg0 && skip == 0) { loc = 10; skip = 1; } if (global.keyitem[11] == arg0 && skip == 0) { loc = 11; skip = 1; }
scr_keyitemshift(loc, 0);
removed = 1; } }
(9);
271
        }
272
        if (global.plot >= 200 && global.flag[387 returned_castle_town] == 0)
273
        {
274
            snd_play(snd_sparkle_glock);
275
            var total_recruits = scr_get_total_recruits(2) + 1;
276
            for (var i = 0; i < total_recruits; i++)
277
            {
278
                sparkle[i] = 
scr_marker
scr_marker

function
scr_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; } return thismarker; }
(kris_x + 15, kris_y + 15, spr_sparestar_anim);
279
                sparkle[i].image_speed = 0.5;
280
                sparkle[i].hspeed = random_range(-3, 3);
281
                sparkle[i].friction = 0.05;
282
                sparkle[i].gravity = -0.1;
283
            }
284
        }
285
    }
286
    if (timer >= 4)
287
    {
288
        if (sus_top > 2)
289
        {
290
            sus_top -= 0.5;
291
            if (quick_mode == 1)
292
                sus_top -= 1.5;
293
        }
294
        else
295
        {
296
            sus_top = 0;
297
        }
298
        if (sus_top >= 2 && kris_only == 0)
299
        {
300
            sus_particle = instance_create(sus_x + 3 + random(sus_width - 6), sus_y + sus_top, obj_dw_transition_particle);
301
            draw_sprite_part(spr_susie_white_fall_d, index / 4, 0, sus_top, sus_width, 1, sus_x, sus_y + sus_top);
302
        }
303
        if (kris_top > 5)
304
        {
305
            kris_top -= 0.5;
306
            if (quick_mode == 1)
307
                kris_top -= 1.5;
308
        }
309
        else
310
        {
311
            kris_top = 0;
312
        }
313
        if (kris_top >= 2)
314
        {
315
            kris_particle = instance_create(kris_x + 3 + random(kris_width - 6), kris_y + kris_top, obj_dw_transition_particle);
316
            draw_sprite_part(spr_kris_fall_d_white, index / 4, 0, kris_top, kris_width, 1, kris_x, kris_y + kris_top);
317
        }
318
    }
319
    threshold = 130;
320
    if (quick_mode == 1)
321
        threshold = 40;
322
    if (timer >= threshold)
323
    {
324
        if (quick_mode == 1)
325
            linecon = 0;
326
        sus_y = round(sus_y);
327
        sus_x = round(sus_x);
328
        kris_y = round(kris_y);
329
        kris_x = round(kris_x);
330
        timer = 0;
331
        sus_v = -0.2;
332
        sus_f = 0.01;
333
        con = 32;
334
    }
335
}
336
if (con == 32)
337
{
338
    if (timer == 0)
339
    {
340
        megablack = 
scr_dark_marker
scr_dark_marker

function
scr_dark_marker(arg0, arg1, arg2)
{ thismarker = instance_create(arg0, arg1, obj_marker); with (thismarker) { sprite_index = arg2; image_speed = 0; image_xscale = 2; image_yscale = 2; } return thismarker; }
(-10, -10, spr_whitepixel);
341
        with (megablack)
342
        {
343
            depth = 150;
344
            image_alpha = 1;
345
            y = -999;
346
            image_xscale = 999;
347
            image_yscale = 999;
348
            image_blend = c_black;
349
            persistent = 1;
350
        }
351
    }
352
    if (timer == 2)
353
        megablack.y = 0;
354
    timer += 1;
355
    if (timer >= 0 && timer < 8)
356
    {
357
        sus_v -= 0.5;
358
        if (kris_only == 0)
359
            draw_sprite_ext(spr_susie_dw_fall_smear, 0, sus_x, sus_y, 1, 1, 0, c_white, 1);
360
        draw_sprite_ext(spr_kris_fall_smear, 0, kris_x, kris_y, 1, 1, 0, c_white, 1);
361
    }
362
    if (timer >= 8 && timer < 12)
363
    {
364
        sus_v += 1;
365
        sus_f = 0;
366
        if (kris_only == 0)
367
            draw_sprite_ext(spr_susie_dw_fall_smear, 1, sus_x, sus_y, 1, 1, 0, c_white, 1);
368
        draw_sprite_ext(spr_kris_fall_smear, 1, kris_x, kris_y, 1, 1, 0, c_white, 1);
369
    }
370
    if (timer >= 12 && timer <= 13)
371
    {
372
        sus_v += 4;
373
        if (kris_only == 0)
374
            draw_sprite_ext(spr_susie_dw_fall_smear, 2, sus_x, sus_y, 1, 1, 0, c_white, 1);
375
        draw_sprite_ext(spr_kris_fall_smear, 2, kris_x, kris_y, 1, 1, 0, c_white, 1);
376
    }
377
    if (timer >= 14)
378
    {
379
        soundcon = 4;
380
        snd_volume(dronesfx, 0, 30);
381
        sus_v = 13;
382
        sus_f = 0;
383
        timer = 0;
384
        con = 33;
385
        rect_draw = 0;
386
    }
387
}
388
if (con == 33)
389
{
390
    timer += 1;
391
    if (quick_mode == 1 && timer < 31)
392
        timer = 31;
393
    if (kris_only == 0)
394
    {
395
        draw_sprite_ext(spr_susie_dw_fall_ball, timer / 2, sus_x, sus_y - (sus_v * 2), 1, 1, 0, c_white, 0.25);
396
        draw_sprite_ext(spr_susie_dw_fall_ball, timer / 2, sus_x, sus_y - sus_v, 1, 1, 0, c_white, 0.5);
397
        draw_sprite_ext(spr_susie_dw_fall_ball, timer / 2, sus_x, sus_y, 1, 1, 0, c_white, 1);
398
    }
399
    draw_sprite_ext(spr_kris_fall_ball, timer / 2, kris_x, kris_y - (sus_v * 2), 1, 1, 0, c_white, 0.25);
400
    draw_sprite_ext(spr_kris_fall_ball, timer / 2, kris_x, kris_y - sus_v, 1, 1, 0, c_white, 0.5);
401
    draw_sprite_ext(spr_kris_fall_ball, timer / 2, kris_x, kris_y, 1, 1, 0, c_white, 1);
402
    if (timer == 14)
403
        linecon = 0;
404
    if (timer == 30)
405
    {
406
        sus_y = -20;
407
        kris_y = -14;
408
    }
409
    if (timer > 30)
410
    {
411
        if (skiprunback == 1 && timer == 36)
412
            snd_play(snd_dtrans_flip);
413
        if (timer == 39)
414
            snd_play(snd_dtrans_flip);
415
        if (sus_y >= (finaly - 8))
416
        {
417
            con = 34;
418
            timer = 0;
419
            sus_v = 0;
420
            kris_y = finaly + 6;
421
            sus_y = finaly;
422
            getup_index = 0;
423
            fake_screenshake = 1;
424
            fake_shakeamount = 8;
425
            remkrisx = kris_x - camerax();
426
            remkrisy = kris_y - cameray();
427
            remsusx = sus_x - camerax();
428
            remsusy = sus_y - cameray();
429
        }
430
    }
431
}
432
if (con == 34)
433
{
434
    snd_stop(dronesfx);
435
    timer += 1;
436
    if (quick_mode == 1 && timer < 15)
437
        timer = 15;
438
    if (timer > 1)
439
    {
440
        if (kris_only == 0)
441
            draw_sprite_ext(spr_susie_dw_landed, getup_index, (sus_x * dz) + fake_shakeamount, sus_y * dz, 1 * dz, 1 * dz, 0, c_white, 1);
442
        draw_sprite_ext(spr_kris_dw_landed, getup_index, (kris_x * dz) + fake_shakeamount, kris_y * dz, 1 * dz, 1 * dz, 0, c_white, 1);
443
    }
444
    if (timer == 26)
445
    {
446
        kris_x = remkrisx;
447
        kris_y = remkrisy;
448
        sus_x = remsusx;
449
        sus_y = remsusy;
450
        if (global.flag[302 toy_deliver_progress] == 1)
451
            global.flag[302 toy_deliver_progress] = 2;
452
        
scr_become_dark
scr_become_dark

function
scr_become_dark()
{ global.darkzone = 1; }
();
453
        dz = global.darkzone + 1;
454
        room_goto(nextroom);
455
    }
456
    if (timer == 27)
457
    {
458
        snd_play(snd_him_quick);
459
        with (obj_mainchara)
460
        {
461
            x = -999;
462
            cutscene = 1;
463
            visible = 0;
464
        }
465
        with (obj_caterpillarchara)
466
        {
467
            x = -999;
468
            visible = 0;
469
        }
470
        if (global.chapter == 2)
471
        {
472
            if (global.plot == 9)
473
            {
474
                obj_mainchara.y = kris_y;
475
                kris_y += 200;
476
                cameray_set(cameray() + 400);
477
            }
478
        }
479
    }
480
    if (timer >= 30 && timer < 60)
481
    {
482
        with (megablack)
483
            image_alpha -= 0.05;
484
        if (quick_mode == 1)
485
        {
486
            with (megablack)
487
                image_alpha -= 0.05;
488
        }
489
    }
490
    if (timer == 50)
491
        getup_index = 1;
492
    if (timer == 53)
493
        getup_index = 2;
494
    if (timer == 55)
495
    {
496
        with (megablack)
497
            instance_destroy();
498
        persistent = 0;
499
        global.interact = 0;
500
        global.facing = 0;
501
        obj_mainchara.x = (kris_x * 2) + 8;
502
        obj_mainchara.y = (kris_y * 2) + 4;
503
        with (obj_mainchara)
504
            visible = 1;
505
        if (i_ex(global.cinstance[1]))
506
        {
507
            with (global.cinstance[1])
508
                instance_destroy();
509
        }
510
        if (kris_only == 0 && i_ex(global.cinstance[0]))
511
        {
512
            global.cinstance[0].x = (sus_x * 2) + 10;
513
            global.cinstance[0].y = sus_y * 2;
514
            with (obj_caterpillarchara)
515
            {
516
                visible = 1;
517
                
scr_caterpillar_interpolate
scr_caterpillar_interpolate

function
scr_caterpillar_interpolate()
{ _newfacing =
scr_facing_letter_to_number(
scr_get_cardinal_direction(point_direction(x, y, obj_mainchara.x, obj_mainchara.y)));
remx[0] = obj_mainchara.x; remy[0] = obj_mainchara.y; facing[0] = _newfacing; for (_iaia = target; _iaia > 0; _iaia -= 1) { remx[_iaia] = lerp(obj_mainchara.x, x, _iaia / target); if (global.darkzone == 1) remy[_iaia] = lerp(obj_mainchara.y, y + 16, _iaia / target); else remy[_iaia] = lerp(obj_mainchara.y, y + 6, _iaia / target); facing[_iaia] = _newfacing; } }
();
518
                facing[target] = 0;
519
                sprite_index = dsprite;
520
            }
521
        }
522
        instance_destroy();
523
    }
524
}
525
if (sus_draw == 1)
526
{
527
    if (instance_exists(obj_kris_headobj))
528
    {
529
        obj_kris_headobj.x = kris_x + 14;
530
        obj_kris_headobj.y = kris_y - 2;
531
    }
532
    if (global.darkzone == 0)
533
    {
534
        draw_sprite_ext(kris_sprite, sus_index, kris_x + fake_shakeamount, kris_y, 1, 1, 0, c_white, 1);
535
        if (kris_only == 0)
536
            draw_sprite_ext(sus_sprite, sus_index, sus_x + fake_shakeamount, sus_y, 1, 1, 0, c_white, 1);
537
    }
538
    else
539
    {
540
        draw_sprite_ext(kris_sprite, sus_index, (kris_x * 2) + fake_shakeamount, kris_y * 2, 2, 2, 0, c_white, 1);
541
        if (kris_only == 0)
542
            draw_sprite_ext(sus_sprite, sus_index, (sus_x * 2) + fake_shakeamount, sus_y * 2, 2, 2, 0, c_white, 1);
543
    }
544
}
545
546
enum e__BG
547
{
548
    Visible,
549
    Foreground,
550
    Index,
551
    X,
552
    Y,
553
    Width,
554
    Height,
555
    HTiled,
556
    VTiled,
557
    XScale,
558
    YScale,
559
    HSpeed,
560
    VSpeed,
561
    Blend,
562
    Alpha
563
}