-
Notifications
You must be signed in to change notification settings - Fork 11
/
[proc,br_loadout_drawloadout].cs2
145 lines (145 loc) · 5.25 KB
/
[proc,br_loadout_drawloadout].cs2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// 3067
[proc,br_loadout_drawloadout](component $component0, component $component1, component $drop2, component $component3)
def_int $intarray0(calc(enum_getoutputcount(enum_2630) + 1));
def_component $component4 = null;
def_int $int5 = 0;
def_namedobj $namedobj6 = null;
def_int $int7 = 0;
def_int $size8 = inv_size(worn);
while ($int7 < $size8) {
$component4 = enum(int, component, enum_2632, $int7);
if ($component4 ! null) {
cc_deleteall($component4);
cc_create($component4, ^iftype_graphic, 0);
cc_setposition(0, 0, ^setpos_abs_centre, ^setpos_abs_centre);
cc_setsize(36, 36, ^setsize_abs, ^setsize_abs);
cc_setgraphic("miscgraphics,0");
cc_create($component4, ^iftype_graphic, 1);
cc_setsize(36, 32, ^setsize_abs, ^setsize_abs);
cc_setposition(2, 0, ^setpos_abs_centre, ^setpos_abs_centre);
$int5 = ~br_loadout_get_worn($int7);
$namedobj6 = enum(int, namedobj, enum_2630, $int5);
if ($namedobj6 ! null) {
cc_settrans(0);
cc_setgraphicshadow(0x333333);
cc_setoutline(1);
if (oc_stackable($namedobj6) = true) {
cc_setobject($namedobj6, 5000);
} else {
cc_setobject($namedobj6, 1);
}
$intarray0($int5) = ~min(calc($intarray0($int5) + 1), enum(obj, int, enum_2631, $namedobj6));
cc_setopbase("<col=ff9040><oc_name($namedobj6)></col>");
cc_setop(1, "Discard");
cc_setop(10, "Examine");
cc_setonop("cc_settrans_temporarily(event_com, cc_getid, 100, 0)");
cc_setdraggable($component0, -1);
cc_setondragcomplete("br_loadout_rearrange(event_com, event_comsubid, event_drop, event_dropsubid, $int5, $component0, $component1, $drop2, $component3)");
cc_setondrag("br_loadout_hidewarning(event_com, event_comsubid, 1)");
cc_setdragdeadzone(5);
cc_setdragdeadtime(5);
} else {
cc_settrans(255);
cc_clearops;
cc_create($component4, ^iftype_graphic, 2);
cc_setsize(32, 32, ^setsize_abs, ^setsize_abs);
cc_setposition(0, 0, ^setpos_abs_centre, ^setpos_abs_centre);
cc_setgraphic(enum(int, graphic, enum_904, $int7));
}
}
$int7 = calc($int7 + 1);
}
cc_deleteall($component1);
def_int $int9 = calc((if_getwidth($component1) - 6 - 4 * 36) / 3 + 36);
def_int $int10 = calc((if_getheight($component1) - 6 - 7 * 32) / 6 + 32);
$int7 = 0;
def_int $size11 = inv_size(inv);
while ($int7 < $size11) {
$int5 = ~br_loadout_get_inv($int7);
$namedobj6 = enum(int, namedobj, enum_2630, $int5);
cc_create($component1, ^iftype_graphic, $int7);
cc_setposition(calc(4 + $int9 * ($int7 % 4)), calc(3 + $int10 * ($int7 / 4)), ^setpos_abs_left, ^setpos_abs_top);
cc_setsize(36, 32, ^setsize_abs, ^setsize_abs);
if ($namedobj6 ! null) {
cc_settrans(0);
cc_setgraphicshadow(0x333333);
cc_setoutline(1);
if (oc_stackable($namedobj6) = true) {
cc_setobject($namedobj6, 5000);
} else {
cc_setobject($namedobj6, 1);
}
$intarray0($int5) = ~min(calc($intarray0($int5) + 1), enum(obj, int, enum_2631, $namedobj6));
cc_setopbase("<col=ff9040><oc_name($namedobj6)></col>");
cc_setop(1, "Discard");
cc_setop(10, "Examine");
cc_setonop("cc_settrans_temporarily(event_com, cc_getid, 100, 0)");
cc_setdraggable($component0, -1);
cc_setondragcomplete("br_loadout_rearrange(event_com, event_comsubid, event_drop, event_dropsubid, $int5, $component0, $component1, $drop2, $component3)");
cc_setondrag("br_loadout_hidewarning(event_com, event_comsubid, $size11)");
cc_setdragdeadzone(5);
cc_setdragdeadtime(5);
} else {
cc_settrans(255);
cc_clearops;
}
$int7 = calc($int7 + 1);
}
def_int $int12 = $int7;
def_int $int13 = 0;
$int7 = $size8;
while ($int7 > 0) {
$int7 = calc($int7 - 1);
$component4 = enum(int, component, enum_2632, $int7);
if ($component4 ! null) {
$int5 = ~br_loadout_get_worn($int7);
$namedobj6 = enum(int, namedobj, enum_2630, $int5);
if ($namedobj6 ! null) {
if ($intarray0($int5) > 0) {
$intarray0($int5) = calc($intarray0($int5) - 1);
} else {
cc_create($component4, ^iftype_model, 2);
cc_setsize(36, 32, ^setsize_abs, ^setsize_abs);
cc_setposition(1, 0, ^setpos_abs_centre, ^setpos_abs_centre);
cc_setmodel(bank_filler_7669);
cc_setmodelangle(0, 0, 512, 512, 0, 1800);
$int13 = 1;
}
}
}
}
$int7 = 0;
while ($int7 < $size11) {
cc_create($component1, ^iftype_model, $int12);
$int12 = calc($int12 + 1);
$int5 = ~br_loadout_get_inv($int7);
$namedobj6 = enum(int, namedobj, enum_2630, $int5);
if ($namedobj6 ! null) {
if ($intarray0($int5) > 0) {
$intarray0($int5) = calc($intarray0($int5) - 1);
cc_sethide(true);
} else {
cc_sethide(false);
cc_setsize(36, 32, ^setsize_abs, ^setsize_abs);
cc_setposition(calc(4 + $int9 * ($int7 % 4)), calc(3 + $int10 * ($int7 / 4)), ^setpos_abs_left, ^setpos_abs_top);
cc_setmodel(bank_filler_7669);
cc_setmodelangle(0, 0, 512, 512, 0, 1800);
$int13 = 1;
}
} else {
cc_sethide(true);
}
$int7 = calc($int7 + 1);
}
$int12 = ~thinbox($component1, $int12);
if ($int13 = 1) {
if_settextfont(p11_full, $component3);
if_setcolour(~tob_hud_nameflasher, $component3);
if_setontimer("tob_hud_nameflasher($component3)", $component3);
if_settext("Your loadout contains too many of the <img=11> items - please discard some.", $component3);
} else {
if_settextfont(p12_full, $component3);
if_setcolour(0xff981f, $component3);
if_setontimer(null, $component3);
if_settext("You will receive these items when a game begins.", $component3);
}