Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_darkness_overlay_Draw_0

(view raw script w/o annotations or w/e)
1
if (
scr_debug
scr_debug

function
scr_debug()
{ return global.debug == 1; }
())
2
{
3
    if (sunkus_kb_check_pressed(ord("V")))
4
        faded = !faded;
5
    if (sunkus_kb_check_pressed(ord("B")))
6
        active = !active;
7
}
8
var drawoutline = draw_silhouettes;
9
var drawripples = false;
10
if (instance_exists(obj_dw_church_intro_gerson))
11
    drawoutline = false;
12
if (instance_exists(obj_dw_church_darkclimb))
13
    drawoutline = false;
14
if (instance_exists(obj_dw_churchc_darkswords))
15
    drawoutline = false;
16
if (instance_exists(obj_dw_churchc_dodge))
17
    drawoutline = false;
18
if (instance_exists(obj_dw_churchc_ripplesneak_poc))
19
    drawoutline = false;
20
if (instance_exists(obj_dw_churchc_ripplesneak_poc))
21
    drawripples = true;
22
if (i_ex(obj_overworld_darkness_bulletarea))
23
    obj_overworld_darkness_bulletarea.active = active;
24
if (!active)
25
    exit;
26
if (image_alpha == 0)
27
    exit;
28
if (!surface_exists(darkness_surf))
29
    darkness_surf = surface_create(640, 480);
30
if (!surface_exists(dim_surf))
31
    dim_surf = surface_create(640, 480);
32
surface_set_target(dim_surf);
33
draw_set_blend_mode(bm_normal);
34
draw_clear(c_black);
35
if (drawripples)
36
{
37
    var map_id = 
scr_layer_tilemap_get_id_fixed
scr_layer_tilemap_get_id_fixed

function
scr_layer_tilemap_get_id_fixed(arg0)
{ var els = layer_get_all_elements(arg0); var n = array_length_1d(els); for (var i = 0; i < n; i++) { var el = els[i]; if (layer_get_element_type(el) == 5) return el; } return -1; }
("TILES_BATTLEBORDER");
38
    draw_tilemap(map_id, -camerax(), -cameray());
39
    with (obj_church_ripple)
40
    {
41
        if (!dodraw)
42
        {
43
            x -= camerax();
44
            y -= cameray();
45
            event_user(10);
46
            x += camerax();
47
            y += cameray();
48
        }
49
    }
50
    with (obj_dw_church_waterfallchaser_churchc)
51
    {
52
        x -= camerax();
53
        y -= cameray();
54
        draw_self();
55
        x += camerax();
56
        y += cameray();
57
    }
58
}
59
with (obj_lightsource_behind)
60
    event_user(6);
61
var _arrayCount = 0;
62
var _char_array;
63
with (obj_mainchara)
64
{
65
    if (visible)
66
    {
67
        _char_array[_arrayCount] = self;
68
        _arrayCount++;
69
    }
70
}
71
if (drawoutline)
72
{
73
    with (obj_actor)
74
    {
75
        if (visible)
76
        {
77
            _char_array[_arrayCount] = self;
78
            _arrayCount++;
79
        }
80
    }
81
    with (obj_dw_church_turtles)
82
    {
83
        if (i_ex(gerson))
84
        {
85
            _char_array[_arrayCount] = gerson;
86
            _arrayCount++;
87
        }
88
    }
89
    with (obj_dw_church_intro_gerson)
90
    {
91
        if (i_ex(gerson))
92
        {
93
            if (gerson.visible)
94
            {
95
                _char_array[_arrayCount] = gerson;
96
                _arrayCount++;
97
            }
98
        }
99
    }
100
    var krcol = 15245824;
101
    var sucol = 13138410;
102
    var racol = 1959605;
103
    var gercol = 2533989;
104
    var nocol = 12320748;
105
    with (obj_dw_church_bookshelfpuzzle)
106
    {
107
        if (i_ex(ranpc))
108
        {
109
            with (ranpc.marker)
110
            {
111
                outlineColor = racol;
112
                _char_array[_arrayCount] = id;
113
                _arrayCount++;
114
            }
115
        }
116
        if (i_ex(sunpc))
117
        {
118
            with (sunpc.marker)
119
            {
120
                outlineColor = sucol;
121
                _char_array[_arrayCount] = id;
122
                _arrayCount++;
123
            }
124
        }
125
    }
126
    with (obj_dw_church_pianopiece_right)
127
    {
128
        if (i_ex(ranpc))
129
        {
130
            with (ranpc.marker)
131
            {
132
                outlineColor = racol;
133
                _char_array[_arrayCount] = id;
134
                _arrayCount++;
135
            }
136
        }
137
        if (i_ex(sunpc))
138
        {
139
            with (sunpc.marker)
140
            {
141
                outlineColor = sucol;
142
                _char_array[_arrayCount] = id;
143
                _arrayCount++;
144
            }
145
        }
146
    }
147
    with (obj_caterpillarchara)
148
    {
149
        if (visible)
150
        {
151
            _char_array[_arrayCount] = self;
152
            _arrayCount++;
153
        }
154
    }
155
    with (obj_npc_room)
156
    {
157
        if (visible)
158
        {
159
            _char_array[_arrayCount] = self;
160
            _arrayCount++;
161
        }
162
    }
163
    with (obj_npc_room_animated)
164
    {
165
        if (visible)
166
        {
167
            _char_array[_arrayCount] = self;
168
            _arrayCount++;
169
        }
170
    }
171
    with (obj_dw_church_darkmaze)
172
    {
173
        if (i_ex(gerson))
174
        {
175
            if (gerson.visible)
176
            {
177
                _char_array[_arrayCount] = gerson;
178
                _arrayCount++;
179
            }
180
        }
181
        if (i_ex(germark))
182
        {
183
            if (germark.visible)
184
            {
185
                _char_array[_arrayCount] = germark;
186
                _arrayCount++;
187
            }
188
        }
189
        if (i_ex(sumark))
190
        {
191
            if (sumark.visible)
192
            {
193
                _char_array[_arrayCount] = sumark;
194
                _arrayCount++;
195
            }
196
        }
197
        if (i_ex(ramark))
198
        {
199
            if (ramark.visible)
200
            {
201
                _char_array[_arrayCount] = ramark;
202
                _arrayCount++;
203
            }
204
        }
205
    }
206
}
207
with (obj_darkness_unlit_object_interactable)
208
{
209
    _char_array[_arrayCount] = self;
210
    _arrayCount++;
211
}
212
with (obj_character_church_window_silhouette)
213
{
214
    _char_array[_arrayCount] = self;
215
    _arrayCount++;
216
}
217
with (obj_darkness_unlit_object)
218
{
219
    _char_array[_arrayCount] = self;
220
    _arrayCount++;
221
}
222
with (obj_marker_darkness_unlit)
223
{
224
    if (sprite_exists(sprite_index))
225
    {
226
        _char_array[_arrayCount] = self;
227
        _arrayCount++;
228
    }
229
}
230
with (obj_darkness_bullet)
231
{
232
    _char_array[_arrayCount] = self;
233
    _arrayCount++;
234
}
235
if (_arrayCount > 1)
236
    _char_array = scr_sort_by_depth(_char_array, false);
237
if (castShadow)
238
{
239
    for (var i = 0; i < _arrayCount; i++)
240
    {
241
        with (_char_array[i])
242
        {
243
            if (object_index == obj_character_church_window_silhouette || object_index == obj_darkness_unlit_object || object_index == obj_darkness_illusion || object_index == obj_darkness_bullet || object_index == obj_marker_darkness_unlit)
244
            {
245
                continue;
246
            }
247
            else
248
            {
249
                var _forceOff = false;
250
                var _yoff = 4;
251
                if (object_index == obj_caterpillarchara)
252
                {
253
                    if (shadow_force_off)
254
                    {
255
                        _forceOff = true;
256
                    }
257
                    else if (name == "susie")
258
                    {
259
                        _yoff = 0;
260
                    }
261
                    else if (name == "ralsei")
262
                    {
263
                        if (facing[target] == 0)
264
                            _yoff = 8;
265
                        else if (facing[target] == 2)
266
                            _yoff = 12;
267
                    }
268
                }
269
                if (!_forceOff)
270
                    draw_sprite_ext(sprite_index, image_index, screenx(), (screeny() + ((sprite_height - sprite_yoffset) * 2)) - _yoff, image_xscale, -image_yscale, image_angle, c_black, image_alpha);
271
            }
272
        }
273
    }
274
}
275
var _battlemode = false;
276
with (obj_growtangle)
277
{
278
    with (obj_mainchara)
279
    {
280
        if (battlemode)
281
            _battlemode = true;
282
    }
283
}
284
if (instance_exists(obj_growtangle))
285
{
286
    with (obj_ghosthouse_lock)
287
    {
288
        _blend = merge_color(image_blend, c_black, other.fade_in);
289
        draw_sprite_ext(sprite_index, 0, x - camerax(), y - cameray(), image_xscale, image_yscale, image_angle, _blend, image_alpha);
290
    }
291
    with (obj_lightsource_lamp)
292
    {
293
        _blend = merge_color(image_blend, c_black, other.fade_in);
294
        draw_sprite_ext(sprite_index, 0, x - camerax(), y - cameray(), image_xscale, image_yscale, image_angle, _blend, image_alpha);
295
    }
296
    with (obj_battlesolid)
297
    {
298
        if (sprite_index == spr_ghost_house_the_chimney || other.draw_all_solids)
299
        {
300
            _blend = merge_color(image_blend, c_black, other.fade_in);
301
            draw_sprite_ext(sprite_index, 0, x - camerax(), y - cameray(), image_xscale, image_yscale, image_angle, _blend, image_alpha);
302
        }
303
    }
304
    with (obj_growtangle)
305
    {
306
        if (growcon != 3 && visible)
307
        {
308
            _blend = merge_color(image_blend, c_black, other.fade_in);
309
            draw_sprite_ext(sprite_index, 0, x - camerax(), y - cameray(), image_xscale, image_yscale, image_angle, _blend, image_alpha);
310
        }
311
    }
312
    with (obj_ghosthouse_jackolantern_merciful)
313
    {
314
        if (scare_con >= 1)
315
        {
316
            draw_sprite_ext(head_sprite, 0, screenx(), screeny(), image_xscale, image_yscale, image_angle, image_blend, image_alpha);
317
            var _spimmer = 
scr_ease_out
scr_ease_out

function
scr_ease_out(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_out_bounce(arg0, 0, 1, 1); case -2: return ease_out_elastic(arg0, 0, 1, 1); case -1: return ease_out_back(arg0, 0, 1, 1); case 0: return arg0; case 1: return sin(arg0 * 1.5707963267948966); case 2: return -arg0 * (arg0 - 2); case 6: return -power(2, -10 * arg0) + 1; case 7: arg0--; return sqrt(1 - (arg0 * arg0)); default: arg0--; if (arg1 == 4) { return -1 * (power(arg0, arg1) - 1); break; } return power(arg0, arg1) + 1; } }
(face_timer / 40, -2) * 180;
318
            draw_sprite_ext(mouth_sprite, 0, screenx(), screeny() + 20, image_xscale, image_yscale, image_angle + _spimmer, image_blend, image_alpha);
319
        }
320
        else if (funny)
321
        {
322
            _blend = merge_color(image_blend, c_black, other.fade_in);
323
            draw_sprite_pos(sprite_index, image_index, screenx(sx[0]), screeny(sy[0]), screenx(sx[1]), screeny(sy[1]), screenx(sx[2]), screeny(sy[2]), screenx(sx[3]), screeny(sy[3]), brightness);
324
        }
325
        else if (ticks > 0)
326
        {
327
            _blend = merge_color(image_blend, c_black, other.fade_in);
328
            draw_sprite_ext(sprite_index, image_index, screenx() + shakex, screeny() + shakey, image_xscale, image_yscale, image_angle, _blend, image_alpha);
329
        }
330
        else
331
        {
332
            _blend = merge_color(image_blend, c_black, other.fade_in);
333
            draw_sprite_ext(sprite_index, image_index, screenx(), screeny(), image_xscale, image_yscale, image_angle, _blend, image_alpha);
334
        }
335
        if (total_ticks > 0 || screamcon == 2)
336
        {
337
            gpu_set_fog(true, c_white, 0, 1000);
338
            if (funny)
339
                draw_sprite_pos(sprite_index, image_index, screenx(sx[0]), screeny(sy[0]), screenx(sx[1]), screeny(sy[1]), screenx(sx[2]), screeny(sy[2]), screenx(sx[3]), screeny(sy[3]), brightness);
340
            else
341
                draw_sprite_ext(sprite_index, image_index, screenx() + shakex, screeny() + shakey, image_xscale, image_yscale, image_angle, image_blend, brightness);
342
        }
343
        gpu_set_fog(false, c_white, 0, 1000);
344
    }
345
    var _blend = merge_color(image_blend, c_black, fade_in);
346
    draw_sprite_ext(sprite_index, 0, x - camerax(), y - cameray(), image_xscale, image_yscale, image_angle, _blend, image_alpha);
347
}
348
for (var i = 0; i < _arrayCount; i++)
349
{
350
    with (_char_array[i])
351
    {
352
        if (object_index == obj_character_church_window_silhouette)
353
        {
354
            event_user(6);
355
        }
356
        else
357
        {
358
            if (object_index == obj_darkness_unlit_object || object_index == obj_darkness_illusion || object_index == obj_marker_darkness_unlit)
359
            {
360
                draw_sprite_ext(sprite_index, image_index, x - camerax(), y - cameray(), image_xscale, image_yscale, image_angle, image_blend, image_alpha);
361
                continue;
362
            }
363
            else if (object_index == obj_darkness_bullet)
364
            {
365
                draw_sprite_ext(dark_sprite, image_index, x - camerax(), y - cameray(), image_xscale, image_yscale, image_angle, image_blend, image_alpha);
366
                continue;
367
            }
368
            if (!iv_ex(_char_array[i], "outlineColor"))
369
            {
370
                if (other.outline_style == 0)
371
                    outlineColor = other.outline_default;
372
                else
373
                    outlineColor = scr_get_outline_color(_char_array[i], other.outline_default, other.outline_style);
374
            }
375
            var _outlineColor = merge_color(c_black, outlineColor, other.highlightalpha);
376
            if (i_ex(id) && image_alpha < 1 && visible)
377
            {
378
            }
379
            if (_battlemode && obj_battlealphaer.battlealpha > 0)
380
                _outlineColor = merge_color(_outlineColor, c_black, 1);
381
            if (drawoutline)
382
            {
383
                d3d_set_fog(true, _outlineColor, 0, 1);
384
                draw_sprite_ext(sprite_index, image_index, x - camerax(), y - cameray(), image_xscale, image_yscale, image_angle, image_blend, image_alpha);
385
                d3d_set_fog(false, c_black, 0, 1);
386
                gpu_set_alphatestenable(true);
387
                gpu_set_blendmode_ext_sepalpha(bm_src_alpha, bm_inv_src_alpha, bm_dest_alpha, bm_zero);
388
                draw_sprite_ext(sprite_index, image_index, x - camerax(), (y - cameray()) + 2, image_xscale, image_yscale, image_angle, c_black, image_alpha);
389
                draw_set_blend_mode(bm_normal);
390
                gpu_set_alphatestenable(false);
391
            }
392
            if (object_index == obj_mainchara && _battlemode && battlealpha > 0)
393
            {
394
                if (fun == 0)
395
                {
396
                    if (global.facing == 0)
397
                        draw_sprite_ext(spr_krisd_heart_outline, image_index, screenx(), screeny(), image_xscale, image_yscale, 0, image_blend, battlealpha);
398
                    if (global.facing == 1)
399
                        draw_sprite_ext(spr_krisr_heart_outline, image_index, screenx(), screeny(), image_xscale, image_yscale, 0, image_blend, battlealpha);
400
                    if (global.facing == 2)
401
                        draw_sprite_ext(spr_krisu_heart_outline, image_index, screenx(), screeny(), image_xscale, image_yscale, 0, image_blend, battlealpha);
402
                    if (global.facing == 3)
403
                        draw_sprite_ext(spr_krisl_heart_outline, image_index, screenx(), screeny(), image_xscale, image_yscale, 0, image_blend, battlealpha);
404
                }
405
                else if (sprite_index == spr_krisd_slide)
406
                {
407
                    draw_sprite_ext(spr_krisd_slide_heart_outline, image_index, x, y, image_xscale, image_yscale, 0, image_blend, battlealpha);
408
                }
409
                draw_sprite_ext(spr_heart_outline2, 0, screenx() + 12, screeny() + 40, 1, 1, 0, c_white, battlealpha * 2);
410
            }
411
        }
412
    }
413
}
414
draw_set_blend_mode(bm_subtract);
415
with (obj_lightsource)
416
    event_user(6);
417
surface_reset_target();
418
draw_set_blend_mode(bm_normal);
419
surface_set_target(darkness_surf);
420
draw_clear_alpha(c_black, 0);
421
surface_reset_target();
422
surface_copy(darkness_surf, 0, 0, dim_surf);
423
surface_set_target(darkness_surf);
424
draw_set_blend_mode(bm_subtract);
425
with (obj_lightsource)
426
    event_user(7);
427
surface_reset_target();
428
draw_set_blend_mode(bm_normal);
429
draw_surface_ext(dim_surf, camerax(), cameray(), 1, 1, 0, c_white, 0.5 * image_alpha);
430
draw_surface_ext(darkness_surf, camerax(), cameray(), 1, 1, 0, c_white, image_alpha);
431
with (obj_marker)
432
{
433
    if (variable_instance_exists(id, "glow"))
434
    {
435
        if (glow == true)
436
            draw_self();
437
    }
438
    else
439
    {
440
        glow = false;
441
    }
442
}