Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_charbox_ch1

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

function scr_charbox_ch1() { for (c = 0; c < 3; c += 1) { if (havechar[c] == 1) { if (c == 0) charcolor = hpcolor[0]; if (c == 1) charcolor = hpcolor[1]; if (c == 2) charcolor = hpcolor[2]; gc = global.charturn; xchunk = 0; if (charpos[c] == 0 && chartotal == 3) xchunk = 0; if (charpos[c] == 1 && chartotal == 3) xchunk = 212; if (charpos[c] == 2 && chartotal == 3) xchunk = 424; if (charpos[c] == 0 && chartotal == 2) xchunk = 106; if (charpos[c] == 1 && chartotal == 2) xchunk = 326; if (charpos[c] == 0 && chartotal == 1) xchunk = 212; if (gc == charpos[c]) { if (global.myfight == 0) scr_selectionmatrix_ch1(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) { for (sglowi = 0; sglowi < 3; sglowi += 1) { if (global.monster[sglowi] == 1 && global.monsterstatus[sglowi] == 1 && global.tension >= 40) pacify_glow = 1; if (global.encounterno == 31) pacify_glow = 0; } } draw_sprite(scr_84_get_sprite_ch1("spr_btfight"), btc[0], xx + xchunk + 15, (485 - bp) + yy); if (c == 0) draw_sprite(scr_84_get_sprite_ch1("spr_btact"), btc[1], xx + xchunk + 50, (485 - bp) + yy); else draw_sprite(scr_84_get_sprite_ch1("spr_bttech"), btc[1], xx + xchunk + 50, (485 - bp) + yy); draw_sprite(scr_84_get_sprite_ch1("spr_btitem"), btc[2], xx + xchunk + 85, (485 - bp) + yy); draw_sprite(scr_84_get_sprite_ch1("spr_btspare"), btc[3], xx + xchunk + 120, (485 - bp) + yy); draw_sprite(scr_84_get_sprite_ch1("spr_btdefend"), btc[4], xx + xchunk + 155, (485 - bp) + yy); if (spare_glow == 1 && gc == charpos[c]) draw_sprite_ext(scr_84_get_sprite_ch1("spr_btspare"), 2, xx + xchunk + 120, (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_ch1("spr_bttech"), 2, xx + xchunk + 50, (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 - 2) + yy + mmy[c], xx + xchunk + 212, (480 - bp) + yy, false); draw_set_color(c_black); draw_rectangle(xx + xchunk + 2, (480 - bp) + yy + mmy[c], xx + xchunk + 210, (480 - bp) + yy + mmy[c] + 33, false); b_offset = 480; if (global.fighting == 0) b_offset = 430; if (global.fighting == 1) ...
()
2
{
3
    for (c = 0; c < 3; 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
            gc = global.charturn;
14
            xchunk = 0;
15
            if (charpos[c] == 0 && chartotal == 3)
16
                xchunk = 0;
17
            if (charpos[c] == 1 && chartotal == 3)
18
                xchunk = 212;
19
            if (charpos[c] == 2 && chartotal == 3)
20
                xchunk = 424;
21
            if (charpos[c] == 0 && chartotal == 2)
22
                xchunk = 106;
23
            if (charpos[c] == 1 && chartotal == 2)
24
                xchunk = 326;
25
            if (charpos[c] == 0 && chartotal == 1)
26
                xchunk = 212;
27
            if (gc == charpos[c])
28
            {
29
                if (global.myfight == 0)
30
                    scr_selectionmatrix_ch1
scr_selectionmatrix_ch1

function scr_selectionmatrix_ch1(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, slmxx, slmyy + 33, 2); draw_line_width(slmxx + 210, slmyy, slmxx + 210, 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);
31
                if (mmy[c] > -32)
32
                    mmy[c] -= 2;
33
                if (mmy[c] > -24)
34
                    mmy[c] -= 4;
35
                if (mmy[c] > -16)
36
                    mmy[c] -= 6;
37
                if (mmy[c] > -8)
38
                    mmy[c] -= 8;
39
                if (mmy[c] < -32)
40
                    mmy[c] = -64;
41
            }
42
            else if (mmy[c] < -14)
43
            {
44
                mmy[c] += 15;
45
            }
46
            else
47
            {
48
                mmy[c] = 0;
49
            }
50
            btc[0] = 0;
51
            btc[1] = 0;
52
            btc[2] = 0;
53
            btc[3] = 0;
54
            btc[4] = 0;
55
            if (gc == charpos[c])
56
                btc[global.bmenucoord[0][global.charturn]] = 1;
57
            if (global.fighting == 1)
58
            {
59
                spare_glow = 0;
60
                for (sglowi = 0; sglowi < 3; sglowi += 1)
61
                {
62
                    if (global.monster[sglowi] == 1 && global.mercymod[sglowi] >= 100)
63
                        spare_glow = 1;
64
                }
65
                pacify_glow = 0;
66
                if (c == 2)
67
                {
68
                    for (sglowi = 0; sglowi < 3; sglowi += 1)
69
                    {
70
                        if (global.monster[sglowi] == 1 && global.monsterstatus[sglowi] == 1 && global.tension >= 40)
71
                            pacify_glow = 1;
72
                        if (global.encounterno == 31)
73
                            pacify_glow = 0;
74
                    }
75
                }
76
                draw_sprite(scr_84_get_sprite_ch1
scr_84_get_sprite_ch1

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

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

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

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

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

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

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

function scr_84_get_sprite_ch1(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bttech"), 2, xx + xchunk + 50, (485 - bp) + yy, 1, 1, 0, c_white, 0.4 + (sin(global.time / 6) * 0.4));
88
            }
89
            if (gc == charpos[c])
90
                draw_set_color(charcolor);
91
            else
92
                draw_set_color(bcolor);
93
            if (global.charselect == charpos[c] || global.charselect == 3)
94
                draw_set_color(charcolor);
95
            draw_rectangle(xx + xchunk, (480 - bp - 2) + yy + mmy[c], xx + xchunk + 212, (480 - bp) + yy, false);
96
            draw_set_color(c_black);
97
            draw_rectangle(xx + xchunk + 2, (480 - bp) + yy + mmy[c], xx + xchunk + 210, (480 - bp) + yy + mmy[c] + 33, false);
98
            b_offset = 480;
99
            if (global.fighting == 0)
100
                b_offset = 430;
101
            if (global.fighting == 1)
102
                b_offset = 336;
103
            if (c == 0)
104
            {
105
                draw_sprite(spr_headkris_ch1, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
106
                draw_sprite(scr_84_get_sprite_ch1
scr_84_get_sprite_ch1

function scr_84_get_sprite_ch1(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bnamekris"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
107
            }
108
            if (c == 1)
109
            {
110
                draw_sprite(spr_headsusie_ch1, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
111
                draw_sprite(scr_84_get_sprite_ch1
scr_84_get_sprite_ch1

function scr_84_get_sprite_ch1(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bnamesusie"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
112
            }
113
            if (c == 2)
114
            {
115
                draw_sprite(spr_headralsei_ch1, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
116
                draw_sprite(scr_84_get_sprite_ch1
scr_84_get_sprite_ch1

function scr_84_get_sprite_ch1(arg0) { return ds_map_find_value(global.chemg_sprite_map, arg0); }
("spr_bnameralsei"), 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
117
            }
118
            draw_sprite(spr_hpname_ch1, 0, xx + 109 + xchunk, bpoff + b_offset + 11 + mmy[c]);
119
            draw_set_color(c_white);
120
            draw_set_font(global.hpfont);
121
            if ((global.hp[c + 1] / global.maxhp[c + 1]) <= 0.25)
122
                draw_set_color(c_yellow);
123
            if (global.hp[c + 1] <= 0)
124
                draw_set_color(c_red);
125
            draw_set_halign(fa_right);
126
            draw_text(xx + 160 + xchunk, ((bpoff + b_offset) - 2) + mmy[c], string_hash_to_newline(global.hp[c + 1]));
127
            draw_sprite(spr_hpslash_ch1, 0, xx + 159 + xchunk, ((bpoff + b_offset) - 4) + mmy[c]);
128
            draw_text(xx + 205 + xchunk, ((bpoff + b_offset) - 2) + mmy[c], string_hash_to_newline(global.maxhp[c + 1]));
129
            draw_set_halign(fa_left);
130
            draw_set_color(c_maroon);
131
            draw_rectangle(xx + 128 + xchunk, bpoff + b_offset + 11 + mmy[c], xx + 203 + xchunk, bpoff + b_offset + 19 + mmy[c], false);
132
            if (global.hp[c + 1] > 0 && global.maxhp[c + 1] > 0)
133
            {
134
                draw_set_color(charcolor);
135
                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);
136
            }
137
        }
138
    }
139
}