Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_charbox

(view raw script w/o annotations or w/e)
1
function scr_charbox
scr_charbox

function scr_charbox() { for (c = 0; c < 4; c += 1) { if (havechar[c] == 1) { if (c == 0) charcolor = hpcolor[0]; if (c == 1) charcolor = hpcolor[1]; if (c == 2) charcolor = hpcolor[2]; if (c == 3) charcolor = hpcolor[3]; gc = global.charturn; xchunk = 0; if (charpos[c] == 0 && chartotal == 3) xchunk = 0; if (charpos[c] == 1 && chartotal == 3) xchunk = 213; if (charpos[c] == 2 && chartotal == 3) xchunk = 426; if (charpos[c] == 0 && chartotal == 2) xchunk = 108; if (charpos[c] == 1 && chartotal == 2) xchunk = 322; if (charpos[c] == 0 && chartotal == 1) xchunk = 213; if (gc == charpos[c]) { if (global.myfight == 0) scr_selectionmatrix(xx + xchunk, (480 - bp) + yy); if (mmy[c] > -32) mmy[c] -= 2; if (mmy[c] > -24) mmy[c] -= 4; if (mmy[c] > -16) mmy[c] -= 6; if (mmy[c] > -8) mmy[c] -= 8; if (mmy[c] < -32) mmy[c] = -64; } else if (mmy[c] < -14) { mmy[c] += 15; } else { mmy[c] = 0; } btc[0] = 0; btc[1] = 0; btc[2] = 0; btc[3] = 0; btc[4] = 0; if (gc == charpos[c]) btc[global.bmenucoord[0][global.charturn]] = 1; if (global.fighting == 1) { spare_glow = 0; for (sglowi = 0; sglowi < 3; sglowi += 1) { if (global.monster[sglowi] == 1 && global.mercymod[sglowi] >= 100) spare_glow = 1; } pacify_glow = 0; if (c == 2 || c == 3) { for (sglowi = 0; sglowi < 3; sglowi += 1) { var tensionamount = 40; if (c == 3) tensionamount = 80; if (global.monster[sglowi] == 1 && global.monsterstatus[sglowi] == 1 && global.tension >= tensionamount) pacify_glow = 1; if (global.encounterno == 31) pacify_glow = 0; } } var icon_offset = 5; draw_sprite(scr_84_get_sprite("spr_btfight"), btc[0], xx + xchunk + 15 + icon_offset, (485 - bp) + yy); if (c == 0) draw_sprite(scr_84_get_sprite("spr_btact"), btc[1], xx + xchunk + 50 + icon_offset, (485 - bp) + yy); else draw_sprite(scr_84_get_sprite("spr_bttech"), btc[1], xx + xchunk + 50 + icon_offset, (485 - bp) + yy); draw_sprite(scr_84_get_sprite("spr_btitem"), btc[2], xx + xchunk + 85 + icon_offset, (485 - bp) + yy); draw_sprite(scr_84_get_sprite("spr_btspare"), btc[3], xx + xchunk + 120 + icon_offset, (485 - bp) + yy); draw_sprite(scr_84_get_sprite("spr_btdefend"), btc[4], xx + xchunk + 155 + icon_offset, (485 - bp) + yy); if (spare_glow == 1 && gc == charpos[c]) draw_sprite_ext(scr_84_get_sprite("spr_btspare"), 2, xx + xchunk + 120 + icon_offset, (485 - bp) + yy, 1, 1, 0, c_white, 0.4 + (sin(global.time / 6) * 0.4)); if (pacify_glow == 1 && gc == charpos[c]) draw_sprite_ext(scr_84_get_sprite("spr_bttech"), 2, xx + xchunk + 50 + icon_offset, (485 - bp) + yy, 1, 1, 0, c_white, 0.4 + (sin(global.time / 6) * 0.4)); } if (gc == charpos[c]) draw_set_color(charcolor); else draw_set_color(bcolor); if (global.charselect == charpos[c] || global.charselect == 3) draw_set_color(charcolor); draw_rectangle(xx + xchunk, (480 - bp - 3) + yy + mmy[c], xx + xchunk + 212, ((480 - bp) + yy) - 2, false); ...
()
2
{
3
    for (c = 0; c < 4; c += 1)
4
    {
5
        if (havechar[c] == 1)
6
        {
7
            if (c == 0)
8
                charcolor = hpcolor[0];
9
            if (c == 1)
10
                charcolor = hpcolor[1];
11
            if (c == 2)
12
                charcolor = hpcolor[2];
13
            if (c == 3)
14
                charcolor = hpcolor[3];
15
            gc = global.charturn;
16
            xchunk = 0;
17
            if (charpos[c] == 0 && chartotal == 3)
18
                xchunk = 0;
19
            if (charpos[c] == 1 && chartotal == 3)
20
                xchunk = 213;
21
            if (charpos[c] == 2 && chartotal == 3)
22
                xchunk = 426;
23
            if (charpos[c] == 0 && chartotal == 2)
24
                xchunk = 108;
25
            if (charpos[c] == 1 && chartotal == 2)
26
                xchunk = 322;
27
            if (charpos[c] == 0 && chartotal == 1)
28
                xchunk = 213;
29
            if (gc == charpos[c])
30
            {
31
                if (global.myfight == 0)
32
                    scr_selectionmatrix
scr_selectionmatrix

function scr_selectionmatrix(arg0, arg1) { slmxx = arg0; slmyy = arg1; s_siner += 2; draw_set_color(charcolor); draw_rectangle(slmxx, slmyy, slmxx + 210, slmyy + 3, false); for (i = 0; i < 12; i += 1) { myxx = s_siner + (i * (10 * pi)); draw_set_alpha(sin(myxx / 60)); draw_line_width(slmxx, slmyy - 3, slmxx, slmyy + 33, 2); draw_line_width(slmxx + 210 + 1, slmyy - 3, slmxx + 210 + 1, slmyy + 33, 2); if (cos(myxx / 60) < 0) { draw_line_width((slmxx - (sin(myxx / 60) * 30)) + 30, slmyy, (slmxx - (sin(myxx / 60) * 30)) + 30, slmyy + 33, 2); draw_line_width((slmxx + 210 + (sin(myxx / 60) * 30)) - 30, slmyy, (slmxx + 210 + (sin(myxx / 60) * 30)) - 30, slmyy + 33, 2); } } draw_set_alpha(1); }
(xx + xchunk, (480 - bp) + yy);
33
                if (mmy[c] > -32)
34
                    mmy[c] -= 2;
35
                if (mmy[c] > -24)
36
                    mmy[c] -= 4;
37
                if (mmy[c] > -16)
38
                    mmy[c] -= 6;
39
                if (mmy[c] > -8)
40
                    mmy[c] -= 8;
41
                if (mmy[c] < -32)
42
                    mmy[c] = -64;
43
            }
44
            else if (mmy[c] < -14)
45
            {
46
                mmy[c] += 15;
47
            }
48
            else
49
            {
50
                mmy[c] = 0;
51
            }
52
            btc[0] = 0;
53
            btc[1] = 0;
54
            btc[2] = 0;
55
            btc[3] = 0;
56
            btc[4] = 0;
57
            if (gc == charpos[c])
58
                btc[global.bmenucoord[0][global.charturn]] = 1;
59
            if (global.fighting == 1)
60
            {
61
                spare_glow = 0;
62
                for (sglowi = 0; sglowi < 3; sglowi += 1)
63
                {
64
                    if (global.monster[sglowi] == 1 && global.mercymod[sglowi] >= 100)
65
                        spare_glow = 1;
66
                }
67
                pacify_glow = 0;
68
                if (c == 2 || c == 3)
69
                {
70
                    for (sglowi = 0; sglowi < 3; sglowi += 1)
71
                    {
72
                        var tensionamount = 40;
73
                        if (c == 3)
74
                            tensionamount = 80;
75
                        if (global.monster[sglowi] == 1 && global.monsterstatus[sglowi] == 1 && global.tension >= tensionamount)
76
                            pacify_glow = 1;
77
                        if (global.encounterno == 31)
78
                            pacify_glow = 0;
79
                    }
80
                }
81
                var icon_offset = 5;
82
                draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_btfight"), btc[0], xx + xchunk + 15 + icon_offset, (485 - bp) + yy);
83
                if (c == 0)
84
                    draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_btact"), btc[1], xx + xchunk + 50 + icon_offset, (485 - bp) + yy);
85
                else
86
                    draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bttech"), btc[1], xx + xchunk + 50 + icon_offset, (485 - bp) + yy);
87
                draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_btitem"), btc[2], xx + xchunk + 85 + icon_offset, (485 - bp) + yy);
88
                draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_btspare"), btc[3], xx + xchunk + 120 + icon_offset, (485 - bp) + yy);
89
                draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_btdefend"), btc[4], xx + xchunk + 155 + icon_offset, (485 - bp) + yy);
90
                if (spare_glow == 1 && gc == charpos[c])
91
                    draw_sprite_ext(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_btspare"), 2, xx + xchunk + 120 + icon_offset, (485 - bp) + yy, 1, 1, 0, c_white, 0.4 + (sin(global.time / 6) * 0.4));
92
                if (pacify_glow == 1 && gc == charpos[c])
93
                    draw_sprite_ext(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bttech"), 2, xx + xchunk + 50 + icon_offset, (485 - bp) + yy, 1, 1, 0, c_white, 0.4 + (sin(global.time / 6) * 0.4));
94
            }
95
            if (gc == charpos[c])
96
                draw_set_color(charcolor);
97
            else
98
                draw_set_color(bcolor);
99
            if (global.charselect == charpos[c] || global.charselect == 3)
100
                draw_set_color(charcolor);
101
            draw_rectangle(xx + xchunk, (480 - bp - 3) + yy + mmy[c], xx + xchunk + 212, ((480 - bp) + yy) - 2, false);
102
            draw_set_color(c_black);
103
            draw_rectangle(xx + xchunk + 2, (480 - bp - 1) + yy + mmy[c], xx + xchunk + 210, (480 - bp) + yy + mmy[c] + 33, false);
104
            b_offset = 480;
105
            if (global.fighting == 0)
106
                b_offset = 430;
107
            if (global.fighting == 1)
108
                b_offset = 336;
109
            if (c == 0)
110
            {
111
                if (global.chapter == 2 && instance_exists(o_boxingcontroller))
112
                {
113
                    if (o_boxingcontroller.headsprite == spr_bhero_head_a)
114
                        draw_sprite_ext(spr_headthrash, 1, xx + 41 + xchunk, bpoff + 8 + b_offset + mmy[c], 2, 2, 0, c_white, 1);
115
                    if (o_boxingcontroller.headsprite == spr_bhero_head_b)
116
                        draw_sprite_ext(spr_headthrash, 3, xx + 43 + xchunk, bpoff + 8 + b_offset + mmy[c], 2, 2, 0, c_white, 1);
117
                    if (o_boxingcontroller.headsprite == spr_bhero_head_c)
118
                        draw_sprite_ext(spr_headthrash, 2, xx + 43 + xchunk, bpoff + 8 + b_offset + mmy[c], 2, 2, 0, c_white, 1);
119
                    if (o_boxingcontroller.headsprite == spr_bhero_head_d)
120
                        draw_sprite_ext(spr_headthrash, 0, xx + 36 + xchunk, bpoff + 8 + b_offset + mmy[c], 1.6, 1.6, 0, c_white, 1);
121
                    draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bnamethrash"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
122
                }
123
                else
124
                {
125
                    draw_sprite(spr_headkris, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
126
                    draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bnamekris"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
127
                }
128
            }
129
            if (c == 1)
130
            {
131
                draw_sprite(spr_headsusie, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
132
                draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bnamesusie"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
133
            }
134
            if (c == 2)
135
            {
136
                draw_sprite(spr_headralsei, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
137
                draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bnameralsei"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
138
            }
139
            if (c == 3)
140
            {
141
                draw_sprite(spr_headnoelle, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
142
                draw_sprite(scr_84_get_sprite
scr_84_get_sprite

function scr_84_get_sprite(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bnamenoelle"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
143
            }
144
            draw_sprite(spr_hpname, 0, xx + 109 + xchunk, bpoff + b_offset + 11 + mmy[c]);
145
            draw_set_color(c_white);
146
            draw_set_font(global.hpfont);
147
            if ((global.hp[c + 1] / global.maxhp[c + 1]) <= 0.25)
148
                draw_set_color(c_yellow);
149
            if (global.hp[c + 1] <= 0)
150
                draw_set_color(c_red);
151
            draw_set_halign(fa_right);
152
            if (global.chapter == 2 && instance_exists(o_boxingcontroller) && o_boxingcontroller.dead != 0)
153
                draw_text(xx + 160 + xchunk, ((bpoff + b_offset) - 2) + mmy[c], string_hash_to_newline(0));
154
            else
155
                draw_text(xx + 160 + xchunk, ((bpoff + b_offset) - 2) + mmy[c], string_hash_to_newline(global.hp[c + 1]));
156
            draw_sprite(spr_hpslash, 0, xx + 159 + xchunk, ((bpoff + b_offset) - 4) + mmy[c]);
157
            draw_text(xx + 205 + xchunk, ((bpoff + b_offset) - 2) + mmy[c], string_hash_to_newline(global.maxhp[c + 1]));
158
            draw_set_halign(fa_left);
159
            draw_set_color(c_maroon);
160
            draw_rectangle(xx + 128 + xchunk, bpoff + b_offset + 11 + mmy[c], xx + 203 + xchunk, bpoff + b_offset + 19 + mmy[c], false);
161
            if (global.hp[c + 1] > 0 && global.maxhp[c + 1] > 0)
162
            {
163
                draw_set_color(charcolor);
164
                if (global.chapter == 2 && instance_exists(o_boxingcontroller) && o_boxingcontroller.dead != 0)
165
                    draw_rectangle(xx + 128 + xchunk, bpoff + b_offset + 11 + mmy[c], xx + xchunk + 128 + ceil((0 / global.maxhp[c + 1]) * 75), bpoff + b_offset + 19 + mmy[c], false);
166
                else
167
                    draw_rectangle(xx + 128 + xchunk, bpoff + b_offset + 11 + mmy[c], xx + xchunk + 128 + ceil((global.hp[c + 1] / global.maxhp[c + 1]) * 75), bpoff + b_offset + 19 + mmy[c], false);
168
            }
169
        }
170
    }
171
}