| 1 |
if (fakecrash_surface == 0) |
| 2 |
{ |
| 3 |
var ww = window_get_width(); |
| 4 |
var wh = window_get_height(); |
| 5 |
var pot_w = 1; |
| 6 |
while (pot_w < ww) |
| 7 |
pot_w *= 2; |
| 8 |
var pot_h = 1; |
| 9 |
while (pot_h < wh) |
| 10 |
pot_h *= 2; |
| 11 |
fakecrash_surface = surface_create(pot_w, pot_h); |
| 12 |
surface_set_target(fakecrash_surface); |
| 13 |
draw_clear_alpha(c_black, 0); |
| 14 |
var total_pixels = ww * wh; |
| 15 |
var num_pixels = (total_pixels / 4) + (irandom(total_pixels / 16) * 4); |
| 16 |
var rh = ceil(num_pixels / ww); |
| 17 |
draw_set_color(c_black); |
| 18 |
ossafe_fill_rectangle(0, 0, ww - 1, rh - 2); |
| 19 |
ossafe_fill_rectangle(0, rh - 1, (num_pixels % ww) - 1, rh - 1); |
| 20 |
for (var i = 0; i < num_pixels; i += len) |
| 21 |
{ |
| 22 |
var len = floor(ww / 4) + (irandom(ww / 16) * 4); |
| 23 |
if (len > (num_pixels - i)) |
| 24 |
len = num_pixels - i; |
| 25 |
if (irandom(5) == 0) |
| 26 |
{ |
| 27 |
for (var j = 0; j < len; j++) |
| 28 |
{ |
| 29 |
var index = i + j; |
| 30 |
var ix = index % ww; |
| 31 |
var iy = floor(index / ww); |
| 32 |
var r = irandom(256); |
| 33 |
var g = irandom(256); |
| 34 |
var b = irandom(256); |
| 35 |
draw_point_color(ix, iy, make_color_rgb(r, g, b)); |
| 36 |
} |
| 37 |
} |
| 38 |
} |
| 39 |
surface_reset_target(); |
| 40 |
draw_set_color(c_white); |
| 41 |
} |
| 42 |
if (current_time < fakecrash_blank_time) |
| 43 |
{ |
| 44 |
draw_surface(fakecrash_surface, 0, 0); |
| 45 |
} |
| 46 |
else |
| 47 |
{ |
| 48 |
draw_set_color(c_black); |
| 49 |
ossafe_fill_rectangle(0, 0, window_get_width() - 1, window_get_height() - 1); |
| 50 |
draw_set_color(c_white); |
| 51 |
if (!fakecrash_stopped_sounds) |
| 52 |
{ |
| 53 |
audio_stop_all(); |
| 54 |
fakecrash_stopped_sounds = 1; |
| 55 |
} |
| 56 |
} |
| 57 |
if (current_time >= fakecrash_reset_time) |
| 58 |
{ |
| 59 |
if (global.savedata_async_id == -1) |
| 60 |
{ |
| 61 |
surface_free(fakecrash_surface); |
| 62 |
game_restart(); |
| 63 |
} |
| 64 |
} |