1 |
var __result; |
2 |
function __background_set_element(argument0, argument1, argument2, argument3, argument4, argument5, argument6, argument7, argument8, argument9, argument10, argument11, argument12, argument13, argument14) //gml_Script___background_set_element |
3 |
{ |
4 |
var __bind = argument0 |
5 |
var __vis = argument1 |
6 |
var __fore = argument2 |
7 |
var __back = argument3 |
8 |
var __x = argument4 |
9 |
var __y = argument5 |
10 |
var __htiled = argument6 |
11 |
var __vtiled = argument7 |
12 |
var __xscale = argument8 |
13 |
var __yscale = argument9 |
14 |
var __stretch = argument10 |
15 |
var __hspeed = argument11 |
16 |
var __vspeed = argument12 |
17 |
var __blend = argument13 |
18 |
var __alpha = argument14 |
19 |
var __nearestdepth = 1000000000 |
20 |
var __farthestdepth = -1000000000 |
21 |
var __depthinc = 100 |
22 |
__result[0] = -1 |
23 |
__result[1] = -1 |
24 |
var __fgstring = "Compatibility_Foreground_" |
25 |
var __bgstring = "Compatibility_Background_" |
26 |
var __colstring = "Compatibility_Colour" |
27 |
var __fglen = string_length(__fgstring) |
28 |
var __bglen = string_length(__bgstring) |
29 |
var __layerlist = layer_get_all() |
30 |
var __layerlistlength = array_length_1d(__layerlist) |
31 |
var __collayer = -1 |
32 |
for (var __i = 0; __i < 8; __i++) |
33 |
{ |
34 |
__slots[__i] = -1 |
35 |
__isforeground[__i] = false |
36 |
} |
37 |
for (__i = 0; __i < __layerlistlength; __i++) |
38 |
{ |
39 |
var __layername = layer_get_name(__layerlist[__i]) |
40 |
if (string_pos(__fgstring, __layername) > 0) |
41 |
{ |
42 |
var __slotchr = string_char_at(__layername, (__fglen + 1)) |
43 |
if (__slotchr == "") |
44 |
{ |
45 |
} |
46 |
else |
47 |
{ |
48 |
var __slot = real(__slotchr) |
49 |
__slots[__slot] = __layerlist[__i] |
50 |
__isforeground[__slot] = true |
51 |
} |
52 |
} |
53 |
else if (string_pos(__bgstring, __layername) > 0) |
54 |
{ |
55 |
__slotchr = string_char_at(__layername, (__bglen + 1)) |
56 |
if (__slotchr == "") |
57 |
{ |
58 |
} |
59 |
else |
60 |
{ |
61 |
__slot = real(__slotchr) |
62 |
__slots[__slot] = __layerlist[__i] |
63 |
__isforeground[__slot] = false |
64 |
} |
65 |
} |
66 |
else if (string_pos(__colstring, __layername) > 0) |
67 |
{ |
68 |
__collayer = __layerlist[__i] |
69 |
layer_depth(__layerlist[__i], __farthestdepth) |
70 |
} |
71 |
else |
72 |
{ |
73 |
var __currdepth = layer_get_depth(__layerlist[__i]) |
74 |
if (__currdepth < __nearestdepth) |
75 |
__nearestdepth = __currdepth |
76 |
if (__currdepth > __farthestdepth) |
77 |
__farthestdepth = __currdepth |
78 |
} |
79 |
} |
80 |
__farthestdepth += (__depthinc + 1000) |
81 |
__nearestdepth -= __depthinc |
82 |
__farthestdepth = max(__farthestdepth, 2147483600) |
83 |
__nearestdepth = min(__nearestdepth, -2147482000) |
84 |
for (__i = 0; __i < 8; __i++) |
85 |
{ |
86 |
if (__slots[__i] != -1) |
87 |
{ |
88 |
var __depth = 0 |
89 |
if (__isforeground[__i] == true) |
90 |
__depth = __nearestdepth - __i * __depthinc |
91 |
else |
92 |
__depth = __farthestdepth - __depthinc - __slot * __depthinc |
93 |
layer_depth(__slots[__i], __depth) |
94 |
} |
95 |
} |
96 |
if (__collayer != -1) |
97 |
layer_depth(__collayer, __farthestdepth) |
98 |
if (__bind == -1) |
99 |
{ |
100 |
__layername = __colstring |
101 |
var __layerdepth = __farthestdepth |
102 |
} |
103 |
else if (__fore == true) |
104 |
{ |
105 |
__layername = __fgstring + string(__bind) |
106 |
__layerdepth = __nearestdepth - __bind * __depthinc |
107 |
} |
108 |
else |
109 |
{ |
110 |
__layername = __bgstring + string(__bind) |
111 |
__layerdepth = __farthestdepth - __depthinc - __bind * __depthinc |
112 |
} |
113 |
if (__bind == -1) |
114 |
var __layerid = __collayer |
115 |
else |
116 |
__layerid = __slots[__bind] |
117 |
if (__layerid != -1) |
118 |
layer_destroy(__layerid) |
119 |
__layerid = layer_create(__layerdepth, __layername) |
120 |
layer_x(__layerid, __x) |
121 |
layer_y(__layerid, __y) |
122 |
layer_hspeed(__layerid, __hspeed) |
123 |
layer_vspeed(__layerid, __vspeed) |
124 |
var __backel = layer_background_create(__layerid, __back) |
125 |
layer_background_visible(__backel, __vis) |
126 |
layer_background_htiled(__backel, __htiled) |
127 |
layer_background_vtiled(__backel, __vtiled) |
128 |
layer_background_xscale(__backel, __xscale) |
129 |
layer_background_yscale(__backel, __yscale) |
130 |
layer_background_stretch(__backel, __stretch) |
131 |
layer_background_blend(__backel, __blend) |
132 |
layer_background_alpha(__backel, __alpha) |
133 |
__result[0] = __backel |
134 |
__result[1] = __layerid |
135 |
return __result; |
136 |
} |