|
1
|
var _man = 126;
|
|
2
|
if (!instance_exists(_man))
|
|
3
|
{
|
|
4
|
scr_debug_printscr_debug_print
function scr_debug_print()
{
if (!scr_debug())
exit;
}
function scr_debug_clear_all()
{
} ("CASTLEREFLECT MANAGER MISSING. DESTROYING.");
|
|
5
|
instance_destroy();
|
|
6
|
exit;
|
|
7
|
}
|
|
8
|
if (is_culled)
|
|
9
|
exit;
|
|
10
|
generate_tiles();
|
|
11
|
var ys = scr_platswap_yscalescr_platswap_yscale
function scr_platswap_yscale()
{
with (obj_platswap)
return __transition_yscale;
return [0, 1];
} ();
|
|
12
|
var _final_alpha = 0.5 * image_alpha * (1 - ys[0]);
|
|
13
|
if (_final_alpha <= 0)
|
|
14
|
exit;
|
|
15
|
draw_set_blend_mode(bm_add);
|
|
16
|
var _has_ts = surface_exists(tilesurf);
|
|
17
|
var _has_os = surface_exists(_man.surf);
|
|
18
|
var _has_ms = surface_exists(_man.masking_surf);
|
|
19
|
if (_has_ts && _has_os && _has_ms)
|
|
20
|
{
|
|
21
|
shader_replace_simple_set_hook(6);
|
|
22
|
var _cx = camera_get_view_x(view_camera[0]);
|
|
23
|
var _cy = camera_get_view_y(view_camera[0]);
|
|
24
|
var _uvs = _man.surface_uvs;
|
|
25
|
shader_set_uniform_f_array(u_bounds, [_cx / room_width, _cy / room_height, 640 / room_width, 480 / room_height]);
|
|
26
|
var t_sampler = shader_get_sampler_index(shd_castlereflect_layerblend, "u_object_surface");
|
|
27
|
texture_set_stage(t_sampler, surface_get_texture(_man.surf));
|
|
28
|
var t_mask = shader_get_sampler_index(shd_castlereflect_layerblend, "u_mask_surface");
|
|
29
|
texture_set_stage(t_mask, surface_get_texture(_man.masking_surf));
|
|
30
|
shader_set_uniform_f_array(u_uvs, [_uvs[0], _uvs[1], _uvs[2] - _uvs[0], _uvs[3] - _uvs[1]]);
|
|
31
|
var _uvs2 = texture_get_uvs(surface_get_texture(tilesurf));
|
|
32
|
shader_set_uniform_f_array(u_uvs2, [_uvs2[0], _uvs2[1], _uvs2[2] - _uvs2[0], _uvs2[3] - _uvs2[1]]);
|
|
33
|
var _uvs3 = texture_get_uvs(surface_get_texture(_man.masking_surf));
|
|
34
|
shader_set_uniform_f_array(u_uvs3, [_uvs3[0], _uvs3[1], _uvs3[2] - _uvs3[0], _uvs3[3] - _uvs3[1]]);
|
|
35
|
draw_surface_ext(tilesurf, x, y, 1, ys[1], 0, c_white, 1 - ((1 - _final_alpha) * (1 - _final_alpha)));
|
|
36
|
shader_replace_simple_reset_hook();
|
|
37
|
}
|
|
38
|
else if (_has_ts && !_has_os)
|
|
39
|
{
|
|
40
|
draw_surface_ext(tilesurf, x, y, 1, ys[1], 0, c_white, _final_alpha);
|
|
41
|
}
|
|
42
|
else if (_has_os && !_has_ts)
|
|
43
|
{
|
|
44
|
draw_surface_part_ext(_man.surf, x - _man._cx, y - _man._cy, sprite_width, sprite_height, x, y, 1, ys[1], 16777215, _final_alpha);
|
|
45
|
}
|
|
46
|
draw_set_blend_mode(bm_normal);
|