Deltarune (Chapter 5) 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()
{ var haveflowery = false; var soloflowery = false; with (obj_caterpillar_generic) { if (name == "flowery") haveflowery = 1; } if (haveflowery && room == room_dw_post_fountain_close) soloflowery = true; var flx = camerax() + 436; var fly = (bpoff + 421) - (global.fighting * 94); 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 || c == 1) { for (sglowi = 0; sglowi < 3; sglowi += 1) { var tensionamount = 40; if (c == 3) tensionamount = 80; if (c == 1) tensionamount = 160; 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; if (disablesusieralseiattack == 1 && (global.charturn == 1 || global.charturn == 2)) draw_sprite(
scr_84_get_sprite("spr_btfight"), 2, xx + xchunk + 15 + icon_offset, (485 - bp) + yy);
else draw_sprite(
scr_84_get_sprite("spr_btfight"), btc[0], xx + xchunk + 15 + icon_offset, (485 - bp) + yy);
if (global.chapter == 5 && i_ex(obj_flowery_enemy) && obj_flowery_enemy.flowerbuttonactive == true && c == 0) draw_sprite(spr_btact_flower, btc[1], xx + xchunk + 50 + icon_offset, (485 - bp) + yy); else if (c == 0) ...
()
2
{
3
    var haveflowery = false;
4
    var soloflowery = false;
5
    with (obj_caterpillar_generic)
6
    {
7
        if (name == "flowery")
8
            haveflowery = 1;
9
    }
10
    if (haveflowery && room == room_dw_post_fountain_close)
11
        soloflowery = true;
12
    var flx = camerax() + 436;
13
    var fly = (bpoff + 421) - (global.fighting * 94);
14
    for (c = 0; c < 4; c += 1)
15
    {
16
        if (havechar[c] == 1)
17
        {
18
            if (c == 0)
19
                charcolor = hpcolor[0];
20
            if (c == 1)
21
                charcolor = hpcolor[1];
22
            if (c == 2)
23
                charcolor = hpcolor[2];
24
            if (c == 3)
25
                charcolor = hpcolor[3];
26
            gc = global.charturn;
27
            xchunk = 0;
28
            if (charpos[c] == 0 && chartotal == 3)
29
                xchunk = 0;
30
            if (charpos[c] == 1 && chartotal == 3)
31
                xchunk = 213;
32
            if (charpos[c] == 2 && chartotal == 3)
33
                xchunk = 426;
34
            if (charpos[c] == 0 && chartotal == 2)
35
                xchunk = 108;
36
            if (charpos[c] == 1 && chartotal == 2)
37
                xchunk = 322;
38
            if (charpos[c] == 0 && chartotal == 1)
39
                xchunk = 213;
40
            if (gc == charpos[c])
41
            {
42
                if (global.myfight == 0)
43
                    
scr_selectionmatrix
scr_selectionmatrix

function
scr_selectionmatrix(arg0, arg1)
{ slmxx = arg0; slmyy = arg1; s_siner += 2; draw_set_color(charcolor); d_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)); d_line_width(slmxx, slmyy - 3, slmxx, slmyy + 33, 2); d_line_width(slmxx + 210 + 1, slmyy - 3, slmxx + 210 + 1, slmyy + 33, 2); if (cos(myxx / 60) < 0) { d_line_width((slmxx - (sin(myxx / 60) * 30)) + 30, slmyy, (slmxx - (sin(myxx / 60) * 30)) + 30, slmyy + 33, 2); d_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);
44
                if (mmy[c] > -32)
45
                    mmy[c] -= 2;
46
                if (mmy[c] > -24)
47
                    mmy[c] -= 4;
48
                if (mmy[c] > -16)
49
                    mmy[c] -= 6;
50
                if (mmy[c] > -8)
51
                    mmy[c] -= 8;
52
                if (mmy[c] < -32)
53
                    mmy[c] = -64;
54
            }
55
            else if (mmy[c] < -14)
56
            {
57
                mmy[c] += 15;
58
            }
59
            else
60
            {
61
                mmy[c] = 0;
62
            }
63
            btc[0] = 0;
64
            btc[1] = 0;
65
            btc[2] = 0;
66
            btc[3] = 0;
67
            btc[4] = 0;
68
            if (gc == charpos[c])
69
                btc[global.bmenucoord[0][global.charturn]] = 1;
70
            if (global.fighting == 1)
71
            {
72
                spare_glow = 0;
73
                for (sglowi = 0; sglowi < 3; sglowi += 1)
74
                {
75
                    if (global.monster[sglowi] == 1 && global.mercymod[sglowi] >= 100)
76
                        spare_glow = 1;
77
                }
78
                pacify_glow = 0;
79
                if (c == 2 || c == 3 || c == 1)
80
                {
81
                    for (sglowi = 0; sglowi < 3; sglowi += 1)
82
                    {
83
                        var tensionamount = 40;
84
                        if (c == 3)
85
                            tensionamount = 80;
86
                        if (c == 1)
87
                            tensionamount = 160;
88
                        if (global.monster[sglowi] == 1 && global.monsterstatus[sglowi] == 1 && global.tension >= tensionamount)
89
                            pacify_glow = 1;
90
                        if (global.encounterno == 31)
91
                            pacify_glow = 0;
92
                    }
93
                }
94
                var icon_offset = 5;
95
                if (disablesusieralseiattack == 1 && (global.charturn == 1 || global.charturn == 2))
96
                    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"), 2, xx + xchunk + 15 + icon_offset, (485 - bp) + yy);
97
                else
98
                    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);
99
                if (global.chapter == 5 && i_ex(obj_flowery_enemy) && obj_flowery_enemy.flowerbuttonactive == true && c == 0)
100
                    draw_sprite(spr_btact_flower, btc[1], xx + xchunk + 50 + icon_offset, (485 - bp) + yy);
101
                else if (c == 0)
102
                    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);
103
                else
104
                    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);
105
                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);
106
                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);
107
                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);
108
                if (spare_glow == 1 && gc == charpos[c])
109
                    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));
110
                if (pacify_glow == 1 && gc == charpos[c])
111
                    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));
112
            }
113
            if (gc == charpos[c])
114
                draw_set_color(charcolor);
115
            else
116
                draw_set_color(bcolor);
117
            if (global.charselect == charpos[c] || global.charselect == 3)
118
                draw_set_color(charcolor);
119
            d_rectangle(xx + xchunk, (480 - bp - 3) + yy + mmy[c], xx + xchunk + 212, ((480 - bp) + yy) - 2, false);
120
            draw_set_color(c_black);
121
            d_rectangle(xx + xchunk + 2, (480 - bp - 1) + yy + mmy[c], xx + xchunk + 210, (480 - bp) + yy + mmy[c] + 33, false);
122
            b_offset = 480;
123
            if (global.fighting == 0)
124
                b_offset = 430 + (20 * array_get(
scr_platswap_yscale
scr_platswap_yscale

function
scr_platswap_yscale()
{ with (obj_platswap) return __transition_yscale; return [0, 1]; }
(), 0) * (global.interact != 5));
125
            if (global.fighting == 1)
126
                b_offset = 336;
127
            if (c == 0)
128
            {
129
                if (soloflowery)
130
                {
131
                    var bname = 4058;
132
                    if (global.lang == "ja")
133
                        bname = 5501;
134
                    draw_sprite(spr_headflowery, global.faceaction[charpos[c]], xx + 13 + xchunk, (bpoff + b_offset + mmy[c]) - 11);
135
                    draw_sprite(bname, 0, xx + 51 + xchunk, bpoff + b_offset + 3 + mmy[c]);
136
                }
137
                else
138
                {
139
                    draw_sprite(spr_headkris, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
140
                    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]);
141
                }
142
            }
143
            if (c == 1)
144
            {
145
                draw_sprite(spr_headsusie, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
146
                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]);
147
            }
148
            if (c == 2)
149
            {
150
                if (haveflowery)
151
                {
152
                    var bname = 4058;
153
                    if (global.lang == "ja")
154
                        bname = 5501;
155
                    draw_sprite(bname, 0, flx + 41, fly + 12);
156
                    if (global.faceaction[charpos[c]] == 0 || global.faceaction[charpos[c]] == 5 || global.faceaction[charpos[c]] == 9)
157
                        draw_sprite(spr_headflowery, 0, xx + 240 + 198, (bpoff + b_offset + mmy[c]) - 11);
158
                    else
159
                        draw_sprite(spr_headralsei, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
160
                }
161
                else
162
                {
163
                    draw_sprite(spr_headralsei, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
164
                    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]);
165
                }
166
            }
167
            if (c == 3)
168
            {
169
                draw_sprite(spr_headnoelle, global.faceaction[charpos[c]], xx + 13 + xchunk, bpoff + b_offset + mmy[c]);
170
                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]);
171
            }
172
            var hp = global.hp[c + 1];
173
            var maxhp = global.maxhp[c + 1];
174
            if (haveflowery && (soloflowery || c == 2))
175
            {
176
                hp = 999;
177
                maxhp = 999;
178
            }
179
            if (instance_exists(obj_room_man) && c == 0)
180
            {
181
                maxhp = 90;
182
                hp = min(hp, maxhp);
183
            }
184
            draw_sprite(spr_hpname, 0, xx + 109 + xchunk, bpoff + b_offset + 11 + mmy[c]);
185
            draw_set_color(c_white);
186
            draw_set_font(global.hpfont);
187
            if ((hp / maxhp) <= 0.25)
188
                draw_set_color(c_yellow);
189
            if (hp <= 0)
190
                draw_set_color(c_red);
191
            draw_set_halign(fa_right);
192
            draw_text(xx + 160 + xchunk, ((bpoff + b_offset) - 2) + mmy[c], string(hp));
193
            draw_sprite(spr_hpslash, 0, xx + 159 + xchunk, ((bpoff + b_offset) - 4) + mmy[c]);
194
            draw_text(xx + 205 + xchunk, ((bpoff + b_offset) - 2) + mmy[c], string(maxhp));
195
            draw_set_halign(fa_left);
196
            draw_set_color(c_maroon);
197
            d_rectangle(xx + 128 + xchunk, bpoff + b_offset + 11 + mmy[c], xx + 203 + xchunk, bpoff + b_offset + 19 + mmy[c], false);
198
            if (hp > 0 && maxhp > 0)
199
            {
200
                if (haveflowery && (soloflowery || c == 2))
201
                    charcolor = 189950;
202
                draw_set_color(charcolor);
203
                d_rectangle(xx + 128 + xchunk, bpoff + b_offset + 11 + mmy[c], xx + xchunk + 128 + ceil((hp / maxhp) * 75), bpoff + b_offset + 19 + mmy[c], false);
204
            }
205
        }
206
    }
207
}