Deltarune (Chapter 5) script viewer

← back to main script listing

gml_GlobalScript_scr_floortex_generate

(view raw script w/o annotations or w/e)
1
function scr_floortex_setFloorLayers()
2
{
3
    array_delete(layer_floor, 0, array_length(layer_floor));
4
    if (argument_count > 0)
5
    {
6
        if (is_array(argument[0]))
7
        {
8
            for (var i = 0; i < array_length(argument[0]); i++)
9
            {
10
                var layid = layer_get_id(string(argument[0][i]));
11
                if (layer_exists(layid))
12
                    array_push(layer_floor, layid);
13
            }
14
        }
15
        else
16
        {
17
            for (var i = 0; i < argument_count; i++)
18
            {
19
                var layid = layer_get_id(string(argument[i]));
20
                if (layer_exists(layid))
21
                    array_push(layer_floor, layid);
22
            }
23
        }
24
    }
25
}
26
27
function scr_floortex_setWallLayers()
28
{
29
    array_delete(layer_wall, 0, array_length(layer_wall));
30
    if (argument_count > 0)
31
    {
32
        if (is_array(argument[0]))
33
        {
34
            for (var i = 0; i < array_length(argument[0]); i++)
35
            {
36
                var layid = layer_get_id(string(argument[0][i]));
37
                if (layer_exists(layid))
38
                    array_push(layer_wall, layid);
39
            }
40
        }
41
        else
42
        {
43
            for (var i = 0; i < argument_count; i++)
44
            {
45
                var layid = layer_get_id(string(argument[i]));
46
                if (layer_exists(layid))
47
                    array_push(layer_wall, layid);
48
            }
49
        }
50
    }
51
}
52
53
function scr_floortex_initialize()
54
{
55
    if (variable_instance_exists(id, "init"))
56
    {
57
    }
58
    else
59
    {
60
        init = 1;
61
        x = xstart;
62
        y = ystart;
63
        init_spr = sprite_index;
64
        init_xscale = image_xscale;
65
        init_yscale = image_yscale;
66
        front = -4;
67
        back = -4;
68
    }
69
    draw_set_color(c_white);
70
    while (array_length(front_sprite) < frames)
71
        array_push(front_sprite, -4);
72
    while (array_length(back_sprite) < frames)
73
        array_push(back_sprite, -4);
74
    while (array_length(sprite) < frames)
75
        array_push(sprite, -4);
76
    boxTop = bbox_top;
77
    boxBottom = bbox_bottom;
78
    initHeight = sprite_height;
79
    initYscale = image_yscale;
80
    initBboxYdif = boxTop - boxBottom;
81
    var _sprite_index = sprite_index;
82
    var _sprite_height = sprite_height;
83
    var _tilesize = 40;
84
    var _w = sprite_width div _tilesize;
85
    var _h = sprite_height div _tilesize;
86
    var _yorigin = _sprite_height / 2;
87
    switch (_sprite_index)
88
    {
89
        case 745:
90
            _yorigin = 40;
91
            break;
92
        case 8002:
93
            _yorigin = _sprite_height - 40;
94
            break;
95
        case 5754:
96
            _yorigin = 0;
97
            break;
98
        case 5056:
99
            _yorigin = _sprite_height;
100
            break;
101
    }
102
    var _centerLine = instance_place(x, y, obj_plat_floortex_Yorigin);
103
    if (instance_exists(_centerLine))
104
        _yorigin = _centerLine.y - bbox_top;
105
    if (surface_method)
106
    {
107
        surface_width = _w;
108
        surface_height = _h;
109
        surface_x = x;
110
        surface_y = bbox_top;
111
    }
112
    for (var _layer = 0; _layer < array_length(layer_floor); _layer++)
113
    {
114
        var lay_id = layer_floor[_layer];
115
        if (layer_exists(lay_id))
116
            layer_set_visible(lay_id, false);
117
    }
118
    for (var _layer = 0; _layer < array_length(layer_wall); _layer++)
119
    {
120
        var lay_id = layer_wall[_layer];
121
        if (layer_exists(lay_id))
122
            layer_set_visible(lay_id, false);
123
    }
124
    frame = 0;
125
    frame_time = 5;
126
    frame_timer = frame_time;
127
    y_plat = y;
128
    y_ow = y;
129
    var anchor_y = y;
130
    if (surface_method || sprite[0] == -4)
131
    {
132
        image_xscale = sprite_width;
133
        image_yscale = sprite_height;
134
        sprite_index = spr_pxwhite;
135
        y = boxTop + 0;
136
        anchor_y = y + _yorigin;
137
        y_ow = y;
138
        y_plat = anchor_y - (0.1 * _yorigin);
139
    }
140
    else if (sprite[0] != -4)
141
    {
142
        y_plat = (bbox_top + _yorigin) - (0.1 * _yorigin);
143
        var sw = sprite_width;
144
        var sh = sprite_height;
145
        sprite_index = sprite[0];
146
        y = boxTop + sprite_get_yoffset(sprite[0]);
147
        image_xscale = 2;
148
        image_yscale = 2;
149
        y_ow = boxTop;
150
        if (round((sprite_width - sw) * 100) != 0 || round((sprite_height - sh) * 100) != 0)
151
        {
152
            blend = c_red;
153
            
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
("Mismatched-main at: x" + string(xstart) + " y" + string(ystart));
154
            
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
(string(sprite_width) + ";" + string(sw));
155
            
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
(string(sprite_height) + ";" + string(sh));
156
        }
157
        anchor_y = y + _yorigin;
158
    }
159
    front_col = 16777215;
160
    back_col = 16777215;
161
    yscale_ow = image_yscale;
162
    yscale_plat = image_yscale * 0.1;
163
    var _list = ds_list_create();
164
    var _num = collision_rectangle_list(bbox_left + 2, anchor_y - 1, bbox_right - 2, anchor_y + 1, obj_plat_floortex_Yplat, 0, 0, _list, 0);
165
    var _offset_obj = -4;
166
    for (var i = 0; i < _num; i++)
167
    {
168
        if (instance_exists(ds_list_find_value(_list, i)))
169
        {
170
            with (ds_list_find_value(_list, i))
171
            {
172
                if (x == clamp(x, other.bbox_left, other.bbox_right) && y == clamp(y, anchor_y - 2, anchor_y + 2))
173
                {
174
                    _offset_obj = id;
175
                }
176
                else
177
                {
178
                }
179
            }
180
        }
181
    }
182
    if (_num == 0)
183
    {
184
    }
185
    if (instance_exists(_offset_obj))
186
        y_plat -= (sign(_offset_obj.image_yscale) * abs(_offset_obj.sprite_height));
187
    if (sprite[0] != -4)
188
    {
189
        y_plat_anchor = y_plat + (0.1 * (y - bbox_top));
190
    }
191
    else
192
    {
193
    }
194
    image_speed = 0;
195
    bbox_bottom_ow = bbox_bottom;
196
    bbox_top_ow = bbox_top;
197
    image_yscale = yscale_plat;
198
    y = y_plat;
199
    bbox_bottom_plat = bbox_bottom;
200
    bbox_top_plat = bbox_top;
201
    y = y_ow;
202
    image_yscale = yscale_ow;
203
    y_ow_anchor = anchor_y;
204
    if (array_length(wall_layers) == 0)
205
        exit;
206
    ds_list_clear(_list);
207
    var _front = -4;
208
    _num = collision_line_list(x + 2, boxBottom + 20, bbox_right - 2, boxBottom + 20, obj_plat_floortex_FRONT, 0, 0, _list, 1);
209
    for (var i = 0; i < _num; i++)
210
    {
211
        var _obj = ds_list_find_value(_list, i);
212
        if (instance_exists(_obj))
213
        {
214
            if (round(_obj.bbox_top) == round(bbox_bottom + 1))
215
                _front = _obj.id;
216
        }
217
    }
218
    ds_list_destroy(_list);
219
    if (instance_exists(_front))
220
        front = _front;
221
    if (instance_exists(front))
222
    {
223
        with (front)
224
        {
225
            if (variable_instance_exists(id, "init"))
226
            {
227
                sprite_index = init_spr;
228
                image_xscale = init_xscale;
229
                image_yscale = init_yscale;
230
            }
231
            else
232
            {
233
                init = 1;
234
                init_spr = sprite_index;
235
                init_xscale = image_xscale;
236
                init_yscale = image_yscale;
237
            }
238
            floortex = other.id;
239
            other.front_col = blend;
240
            if (other.front_sprite[0] == -4)
241
            {
242
                visible = 0;
243
            }
244
            else
245
            {
246
                var sw = sprite_width;
247
                var sh = sprite_height;
248
                sprite_index = other.front_sprite[0];
249
                image_xscale = 2;
250
                image_yscale = 2;
251
                other.front_width = sprite_width * 1;
252
                other.front_height = sprite_height * 1;
253
                other.front_x = x;
254
                other.front_starty = bbox_top;
255
                if (round((sprite_width - sw) * 100) != 0 || round((sprite_height - sh) * 100) != 0)
256
                {
257
                    other.front_col = 255;
258
                    
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
("Mismatched-front at: x" + string(xstart) + " y" + string(ystart));
259
                    
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
(string(sprite_width) + ";" + string(sw));
260
                    
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
(string(sprite_height) + ";" + string(sh));
261
                }
262
                other.cull_buffer_left = max(other.cull_buffer_left, other.bbox_left - bbox_left);
263
                other.cull_buffer_right = max(other.cull_buffer_right, bbox_right - other.bbox_right);
264
                other.cull_buffer_bottom = max(other.cull_buffer_bottom, bbox_bottom - other.bbox_bottom);
265
                visible = 0;
266
            }
267
        }
268
    }
269
    var _back = collision_line(x + 2, boxTop - 20, bbox_right - 2, boxTop - 20, obj_plat_floortex_BACK, 0, 0);
270
    if (instance_exists(_back))
271
        back = _back;
272
    if (instance_exists(back))
273
    {
274
        with (back)
275
        {
276
            if (variable_instance_exists(id, "init"))
277
            {
278
                sprite_index = init_spr;
279
                image_xscale = init_xscale;
280
                image_yscale = init_yscale;
281
            }
282
            else
283
            {
284
                init = 1;
285
                init_spr = sprite_index;
286
                init_xscale = image_xscale;
287
                init_yscale = image_yscale;
288
            }
289
            floortex = other.id;
290
            other.back_col = blend;
291
            if (other.back_sprite[0] == -4)
292
            {
293
                visible = 0;
294
            }
295
            else
296
            {
297
                var sw = sprite_width;
298
                var sh = sprite_height;
299
                sprite_index = other.back_sprite[0];
300
                image_xscale = 2;
301
                image_yscale = 2;
302
                if (round((sprite_width - sw) * 100) != 0 || round((sprite_height - sh) * 100) != 0)
303
                {
304
                    other.back_col = 255;
305
                    
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
("Mismatched-back at: x" + string(xstart) + " y" + string(ystart));
306
                    
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
(string(sprite_width) + ";" + string(sw));
307
                    
scr_debug_print
scr_debug_print

function
scr_debug_print()
{ if (!
scr_debug())
exit; } function scr_debug_clear_all() { }
(string(sprite_height) + ";" + string(sh));
308
                }
309
                other.back_width = sprite_width;
310
                other.back_height = sprite_height;
311
                other.back_x = x;
312
                other.back_starty = bbox_top;
313
                other.cull_buffer_left = max(other.cull_buffer_left, other.bbox_left - bbox_left);
314
                other.cull_buffer_right = max(other.cull_buffer_right, bbox_right - other.bbox_right);
315
                other.cull_buffer_top = max(other.cull_buffer_top, other.bbox_top - bbox_top);
316
                visible = 0;
317
            }
318
        }
319
    }
320
}
321
322
function 
scr_floortex_generate
scr_floortex_generate

function scr_floortex_setFloorLayers() { array_delete(layer_floor, 0, array_length(layer_floor)); if (argument_count > 0) { if (is_array(argument[0])) { for (var i = 0; i < array_length(argument[0]); i++) { var layid = layer_get_id(string(argument[0][i])); if (layer_exists(layid)) array_push(layer_floor, layid); } } else { for (var i = 0; i < argument_count; i++) { var layid = layer_get_id(string(argument[i])); if (layer_exists(layid)) array_push(layer_floor, layid); } } } } function scr_floortex_setWallLayers() { array_delete(layer_wall, 0, array_length(layer_wall)); if (argument_count > 0) { if (is_array(argument[0])) { for (var i = 0; i < array_length(argument[0]); i++) { var layid = layer_get_id(string(argument[0][i])); if (layer_exists(layid)) array_push(layer_wall, layid); } } else { for (var i = 0; i < argument_count; i++) { var layid = layer_get_id(string(argument[i])); if (layer_exists(layid)) array_push(layer_wall, layid); } } } } function scr_floortex_initialize() { if (variable_instance_exists(id, "init")) { } else { init = 1; x = xstart; y = ystart; init_spr = sprite_index; init_xscale = image_xscale; init_yscale = image_yscale; front = -4; back = -4; } draw_set_color(c_white); while (array_length(front_sprite) < frames) array_push(front_sprite, -4); while (array_length(back_sprite) < frames) array_push(back_sprite, -4); while (array_length(sprite) < frames) array_push(sprite, -4); boxTop = bbox_top; boxBottom = bbox_bottom; initHeight = sprite_height; initYscale = image_yscale; initBboxYdif = boxTop - boxBottom; var _sprite_index = sprite_index; var _sprite_height = sprite_height; var _tilesize = 40; var _w = sprite_width div _tilesize; var _h = sprite_height div _tilesize; var _yorigin = _sprite_height / 2; switch (_sprite_index) { case 745: _yorigin = 40; break; case 8002: _yorigin = _sprite_height - 40; break; case 5754: _yorigin = 0; break; case 5056: _yorigin = _sprite_height; break; } ...
()
323
{
324
    if (variable_instance_exists(id, "init"))
325
    {
326
        sprite_index = init_spr;
327
        image_xscale = init_xscale;
328
        image_yscale = init_yscale;
329
        x = xstart;
330
        y = ystart;
331
    }
332
    else
333
    {
334
        init = 1;
335
        x = xstart;
336
        y = ystart;
337
        init_spr = sprite_index;
338
        init_xscale = image_xscale;
339
        init_yscale = image_yscale;
340
        front = -4;
341
        back = -4;
342
    }
343
    draw_set_color(c_white);
344
    boxTop = bbox_top;
345
    boxBottom = bbox_bottom;
346
    initHeight = sprite_height;
347
    initYscale = image_yscale;
348
    initBboxYdif = boxTop - boxBottom;
349
    var _sprite_index = sprite_index;
350
    var _sprite_height = sprite_height;
351
    var _tilesize = 40;
352
    var _w = sprite_width div _tilesize;
353
    var _h = sprite_height div _tilesize;
354
    if (surface_method)
355
    {
356
        surface_width = _w;
357
        surface_height = _h;
358
        surface_x = x;
359
        surface_y = bbox_top;
360
        for (var _layer = 0; _layer < array_length(layer_floor); _layer++)
361
        {
362
            var lay_id = layer_floor[_layer];
363
            if (layer_exists(lay_id))
364
                layer_set_visible(lay_id, false);
365
        }
366
        for (var _layer = 0; _layer < array_length(layer_wall); _layer++)
367
        {
368
            var lay_id = layer_wall[_layer];
369
            if (layer_exists(lay_id))
370
                layer_set_visible(lay_id, false);
371
        }
372
    }
373
    frame = 0;
374
    frame_time = 5;
375
    frame_timer = frame_time;
376
    for (var i = 0; i < frames; i++)
377
    {
378
        front_sprite[i] = -4;
379
        sprite[i] = -4;
380
        back_sprite[i] = -4;
381
    }
382
    front_col = 16777215;
383
    back_col = 16777215;
384
    var _sw = round(sprite_width);
385
    var _sh = round(sprite_height);
386
    var temp_surface = surface_create(_sw, _sh);
387
    var _yorigin = _sprite_height / 2;
388
    switch (_sprite_index)
389
    {
390
        case 745:
391
            _yorigin = 40;
392
            break;
393
        case 8002:
394
            _yorigin = _sprite_height - 40;
395
            break;
396
        case 5754:
397
            _yorigin = 0;
398
            break;
399
        case 5056:
400
            _yorigin = _sprite_height;
401
            break;
402
    }
403
    var _centerLine = instance_place(x, y, obj_plat_floortex_Yorigin);
404
    if (instance_exists(_centerLine))
405
        _yorigin = _centerLine.y - bbox_top;
406
    if (_yorigin < (_sprite_height / 2))
407
        align_mode = -1;
408
    else if (_yorigin > (_sprite_height / 2))
409
        align_mode = 1;
410
    for (var _frame = 0; _frame < frames; _frame++)
411
    {
412
        sprite[_frame] = -4;
413
        if (!surface_method)
414
        {
415
            surface_set_target(temp_surface);
416
            draw_clear_alpha(c_black, 0);
417
            gpu_set_blendmode_ext(bm_one, bm_inv_src_alpha);
418
            for (var i = 0; i < _w; i++)
419
            {
420
                for (var j = 0; j < _h; j++)
421
                {
422
                    var _x = x + (i * _tilesize);
423
                    var _y = bbox_top + (j * _tilesize);
424
                    if (_y >= room_height)
425
                        _y = room_height - _tilesize;
426
                    if (_y < 0)
427
                        _y = 0;
428
                    for (var _layer = 0; _layer < array_length(layer_floor); _layer++)
429
                    {
430
                        var lay_id = layer_floor[_layer];
431
                        if (layer_exists(lay_id))
432
                        {
433
                            layer_set_visible(lay_id, false);
434
                            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; }
(lay_id);
435
                            var _tx = tilemap_get_cell_x_at_pixel(map_id, _x, _y);
436
                            var _ty = tilemap_get_cell_y_at_pixel(map_id, _x, _y);
437
                            var _tiledata = tilemap_get(map_id, _tx, _ty);
438
                            if (_tiledata > 0)
439
                            {
440
                                skip_main_export = false;
441
                                var _tileset = tilemap_get_tileset(map_id);
442
                                draw_tile(_tileset, _tiledata, _frame, i * _tilesize, j * _tilesize);
443
                            }
444
                        }
445
                    }
446
                }
447
            }
448
            gpu_set_blendmode(bm_normal);
449
            surface_reset_target();
450
            var small_surface = surface_create(0.5 * _sw, 0.5 * _sh);
451
            surface_set_target(small_surface);
452
            gpu_set_blendenable(false);
453
            draw_clear_alpha(c_black, 0);
454
            draw_surface_stretched(temp_surface, 0, 0, 0.5 * _sw, 0.5 * _sh);
455
            gpu_set_blendenable(true);
456
            surface_reset_target();
457
            surface_free(temp_surface);
458
            temp_surface = small_surface;
459
        }
460
        sprite[_frame] = sprite_create_from_surface(temp_surface, 0, 0, _sw * 0.5, _sh * 0.5, 0, 0, 0, _yorigin * 0.5);
461
        sprite_set_bbox_mode(sprite[_frame], 1);
462
    }
463
    surface_free(temp_surface);
464
    sprite_index = sprite[0];
465
    y = boxTop + (sprite_get_yoffset(sprite[0]) * 2);
466
    image_xscale = 2;
467
    image_yscale = 2;
468
    yscale_ow = image_yscale;
469
    yscale_plat = image_yscale * 0.1;
470
    y_plat = y;
471
    y_ow = y;
472
    var _list = ds_list_create();
473
    var _num = collision_rectangle_list(bbox_left + 2, y - 1, bbox_right - 2, y + 1, obj_plat_floortex_Yplat, 0, 0, _list, 0);
474
    var _offset_obj = -4;
475
    for (var i = 0; i < _num; i++)
476
    {
477
        if (instance_exists(ds_list_find_value(_list, i)))
478
        {
479
            with (ds_list_find_value(_list, i))
480
            {
481
                if (x == clamp(x, other.bbox_left, other.bbox_right) && y == clamp(y, other.y - 2, other.y + 2))
482
                    _offset_obj = id;
483
            }
484
        }
485
    }
486
    if (instance_exists(_offset_obj))
487
        y_plat = _offset_obj.y - (sign(_offset_obj.image_yscale) * abs(_offset_obj.sprite_height));
488
    image_speed = 0;
489
    bbox_bottom_ow = bbox_bottom;
490
    bbox_top_ow = bbox_top;
491
    image_yscale = yscale_plat;
492
    y = y_plat;
493
    bbox_bottom_plat = bbox_bottom;
494
    bbox_top_plat = bbox_top;
495
    y = y_ow;
496
    image_yscale = yscale_ow;
497
    y_plat_anchor = y_plat;
498
    y_ow_anchor = y_ow;
499
    if (array_length(wall_layers) == 0)
500
        exit;
501
    var _wall_maps = [];
502
    if (array_length(layer_wall) > 0)
503
    {
504
        for (var i = 0; i < array_length(layer_wall); i++)
505
        {
506
            var _lay_id = layer_wall[i];
507
            if (layer_exists(_lay_id))
508
            {
509
                layer_set_visible(_lay_id, false);
510
                array_push(_wall_maps, 
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; }
(_lay_id));
511
            }
512
        }
513
    }
514
    ds_list_clear(_list);
515
    var _front = -4;
516
    _num = collision_line_list(x + 2, bbox_bottom + 20, bbox_right - 2, bbox_bottom + 20, obj_plat_floortex_FRONT, 0, 0, _list, 1);
517
    for (var i = 0; i < _num; i++)
518
    {
519
        var _obj = ds_list_find_value(_list, i);
520
        if (instance_exists(_obj))
521
        {
522
            if (round(_obj.bbox_top) == round(bbox_bottom + 1))
523
                _front = _obj.id;
524
        }
525
    }
526
    ds_list_destroy(_list);
527
    if (instance_exists(_front))
528
        front = _front;
529
    if (instance_exists(front))
530
    {
531
        with (front)
532
        {
533
            if (variable_instance_exists(id, "init"))
534
            {
535
                sprite_index = init_spr;
536
                image_xscale = init_xscale;
537
                image_yscale = init_yscale;
538
            }
539
            else
540
            {
541
                init = 1;
542
                init_spr = sprite_index;
543
                init_xscale = image_xscale;
544
                init_yscale = image_yscale;
545
            }
546
            floortex = other.id;
547
            other.front_col = blend;
548
            _tilesize = 40;
549
            _w = sprite_width div _tilesize;
550
            _h = sprite_height div _tilesize;
551
            _sw = round(sprite_width);
552
            _sh = round(sprite_height);
553
            temp_surface = surface_create(_sw, _sh);
554
            for (var _frame = 0; _frame < other.frames; _frame++)
555
            {
556
                other.front_sprite[_frame] = -4;
557
                if (!(other.surface_method && other.draw_all_surfaces))
558
                {
559
                    surface_set_target(temp_surface);
560
                    draw_clear_alpha(c_black, 0);
561
                    gpu_set_blendmode_ext_sepalpha(bm_one, bm_inv_src_alpha, bm_one, bm_one);
562
                    for (var i = 0; i < _w; i++)
563
                    {
564
                        for (var j = 0; j < _h; j++)
565
                        {
566
                            var _x = x + (i * _tilesize);
567
                            var _y = bbox_top + (j * _tilesize);
568
                            if (_y >= room_height)
569
                                _y = room_height - _tilesize;
570
                            if (_y < 0)
571
                                _y = 0;
572
                            var _len = array_length(_wall_maps);
573
                            for (var m = 0; m < _len; m++)
574
                            {
575
                                var map_id = _wall_maps[m];
576
                                var _tx = tilemap_get_cell_x_at_pixel(map_id, _x, _y);
577
                                var _ty = tilemap_get_cell_y_at_pixel(map_id, _x, _y);
578
                                var _tiledata = tilemap_get(map_id, _tx, _ty);
579
                                if (_tiledata > 0)
580
                                {
581
                                    other.skip_front_export = false;
582
                                    var _tileset = tilemap_get_tileset(map_id);
583
                                    draw_tile(_tileset, _tiledata, _frame, i * _tilesize, j * _tilesize);
584
                                }
585
                            }
586
                        }
587
                    }
588
                    gpu_set_blendmode(bm_normal);
589
                    shader_replace_simple_reset_hook();
590
                    surface_reset_target();
591
                    var small_surface = surface_create(0.5 * _sw, 0.5 * _sh);
592
                    surface_set_target(small_surface);
593
                    gpu_set_blendenable(false);
594
                    draw_clear_alpha(c_black, 0);
595
                    draw_surface_stretched(temp_surface, 0, 0, 0.5 * _sw, 0.5 * _sh);
596
                    gpu_set_blendenable(true);
597
                    surface_reset_target();
598
                    surface_free(temp_surface);
599
                    temp_surface = small_surface;
600
                }
601
                other.front_sprite[_frame] = sprite_create_from_surface(temp_surface, 0, 0, _sw * 0.5, _sh * 0.5, 0, 0, 0, 0);
602
                sprite_set_bbox_mode(other.front_sprite[_frame], 1);
603
            }
604
            surface_free(temp_surface);
605
            sprite_index = other.front_sprite[0];
606
            image_xscale = 2;
607
            image_yscale = 2;
608
            other.front_width = sprite_width * 1;
609
            other.front_height = sprite_height * 1;
610
            other.front_x = x;
611
            other.front_starty = bbox_top;
612
            other.cull_buffer_left = max(other.cull_buffer_left, other.bbox_left - bbox_left);
613
            other.cull_buffer_right = max(other.cull_buffer_right, bbox_right - other.bbox_right);
614
            other.cull_buffer_bottom = max(other.cull_buffer_bottom, bbox_bottom - other.bbox_bottom);
615
            visible = 0;
616
        }
617
    }
618
    var _back = collision_line(x + 2, bbox_top - 20, bbox_right - 2, bbox_top - 20, obj_plat_floortex_BACK, 0, 0);
619
    if (instance_exists(_back))
620
        back = _back;
621
    if (instance_exists(back))
622
    {
623
        with (back)
624
        {
625
            if (variable_instance_exists(id, "init"))
626
            {
627
                sprite_index = init_spr;
628
                image_xscale = init_xscale;
629
                image_yscale = init_yscale;
630
            }
631
            else
632
            {
633
                init = 1;
634
                init_spr = sprite_index;
635
                init_xscale = image_xscale;
636
                init_yscale = image_yscale;
637
            }
638
            floortex = other.id;
639
            other.back_col = blend;
640
            _tilesize = 40;
641
            _w = sprite_width div _tilesize;
642
            _h = sprite_height div _tilesize;
643
            _sw = round(sprite_width);
644
            _sh = round(sprite_height);
645
            temp_surface = surface_create(_sw, sprite_height);
646
            for (var _frame = 0; _frame < other.frames; _frame++)
647
            {
648
                other.back_sprite[_frame] = -4;
649
                if (!(other.surface_method && other.draw_all_surfaces))
650
                {
651
                    surface_set_target(temp_surface);
652
                    draw_clear_alpha(c_black, 0);
653
                    for (var i = 0; i < _w; i++)
654
                    {
655
                        for (var j = 0; j < _h; j++)
656
                        {
657
                            var _x = x + (i * _tilesize);
658
                            var _y = bbox_top + (j * _tilesize);
659
                            if (_y >= room_height)
660
                                _y = room_height - _tilesize;
661
                            if (_y < 0)
662
                                _y = 0;
663
                            var _len = array_length(_wall_maps);
664
                            for (var m = 0; m < _len; m++)
665
                            {
666
                                var map_id = _wall_maps[m];
667
                                var _tx = tilemap_get_cell_x_at_pixel(map_id, _x, _y);
668
                                var _ty = tilemap_get_cell_y_at_pixel(map_id, _x, _y);
669
                                var _tiledata = tilemap_get(map_id, _tx, _ty);
670
                                if (_tiledata > 0)
671
                                {
672
                                    other.skip_back_export = false;
673
                                    var _tileset = tilemap_get_tileset(map_id);
674
                                    draw_tile(_tileset, _tiledata, _frame, i * _tilesize, j * _tilesize);
675
                                }
676
                            }
677
                        }
678
                    }
679
                    surface_reset_target();
680
                    var small_surface = surface_create(0.5 * _sw, 0.5 * _sh);
681
                    surface_set_target(small_surface);
682
                    gpu_set_blendenable(false);
683
                    draw_clear_alpha(c_black, 0);
684
                    draw_surface_stretched(temp_surface, 0, 0, 0.5 * _sw, 0.5 * _sh);
685
                    gpu_set_blendenable(true);
686
                    surface_reset_target();
687
                    surface_free(temp_surface);
688
                    temp_surface = small_surface;
689
                }
690
                other.back_sprite[_frame] = sprite_create_from_surface(temp_surface, 0, 0, _sw * 0.5, _sh * 0.5, 0, 0, 0, 0);
691
                sprite_set_bbox_mode(other.back_sprite[_frame], 1);
692
            }
693
            surface_free(temp_surface);
694
            sprite_index = other.back_sprite[0];
695
            image_xscale = 2;
696
            image_yscale = 2;
697
            other.back_width = sprite_width;
698
            other.back_height = sprite_height;
699
            other.back_x = x;
700
            other.back_starty = bbox_top;
701
            other.cull_buffer_left = max(other.cull_buffer_left, other.bbox_left - bbox_left);
702
            other.cull_buffer_right = max(other.cull_buffer_right, bbox_right - other.bbox_right);
703
            other.cull_buffer_top = max(other.cull_buffer_top, other.bbox_top - bbox_top);
704
            visible = 0;
705
        }
706
    }
707
}