if (scr_battlebg_fullalpha()) exit; if (array_get(scr_platswap_yscale(), 0) == 1) exit; if (!surface_exists(surf)) surf = surface_create(640, 480); if (!surface_exists(precreate_surf)) precreate_surf = surface_create(640, shadow_falloff); if (!surface_exists(masking_surf)) { masking_surf = surface_create(room_width * 0.5, room_height * 0.5); surface_set_target(masking_surf); draw_clear_alpha(c_black, 0); with (obj_spotlight_blocker) draw_sprite_ext(spr_pxwhite, 0, x * 0.5, y * 0.5, 20 * image_xscale, 20 * image_yscale, image_angle, c_white, 1); with (obj_reflect_gradient) draw_sprite_ext(sprite_index, 0, x * 0.5, y * 0.5, image_xscale * 0.5, image_yscale * 0.5, image_angle, c_white, image_alpha); surface_reset_target(); } var _camoffx = _cx; var _camoffy = _cy; shader_replace_simple_set_hook(48); shader_set_uniform_f(u_falloff, shadow_falloff * 1, 0.5); var _tex = surface_get_texture(surf); var _uvs = texture_get_uvs(_tex); shader_set_uniform_f_array(u_uvs, [_uvs[0], _uvs[1], _uvs[2] - _uvs[0], _uvs[3] - _uvs[1]]); surface_set_target(surf); draw_clear_alpha(c_black, 0); var listsize = ds_list_size(this_frame_objects); for (var i = 0; i < listsize; i++) { with (ds_list_find_value(this_frame_objects, i)) { var x_offset = 0; var y_offset = 0; if (variable_instance_exists(id, "draw_reflection")) { draw_reflection(_camoffx, _camoffy, other.u_y); } else { var refl_off = 0; var yoff = image_yscale * sprite_get_yoffset(sprite_index); var sh = (y + (sprite_height * 2)) - _camoffy - yoff - 2; y_offset = sh; var _yo = 0; if (variable_instance_exists(self, "reflect_jump_y")) refl_off = reflect_jump_y; if (ds_map_exists(other.sprite_offsets, sprite_index)) { _yo = array_get(ds_map_find_value(other.sprite_offsets, sprite_index), 1) * image_yscale; refl_off += (array_get(ds_map_find_value(other.sprite_offsets, sprite_index), 0) * image_yscale); y_offset += _yo; x_offset += (array_get(ds_map_find_value(other.sprite_offsets, sprite_index), 2) * image_xscale); } var si = sprite_index; if (ds_map_exists(other.sprite_subs, sprite_index)) si = ds_map_find_value(other.sprite_subs, sprite_index); if (!sprite_exists(si)) { debug_print_persistent(string(id), "no sprite for reflection: " + string(object_get_name(object_index))); } else { shader_set_uniform_f(other.u_y, (y_offset + 8) - sprite_height - 30); draw_sprite_ext(si, image_index, (x - _camoffx) + x_offset, (y_offset + refl_off) - (2 * yoff) - 8, -image_xscale, image_yscale, 180 + image_angle, image_blend, 1); x_offset = 0; } } } } surface_reset_target(); shader_replace_simple_reset_hook(); _tex = surface_get_texture(surf); surface_uvs = texture_get_uvs(_tex);