Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_battleblcon_Draw_0

(view raw script w/o annotations or w/e)
1
if (i_ex(mywriter))
2
{
3
    mywriter.depth = depth - 5;
4
    if (remmsgno != obj_writer.msgno)
5
        reformatted = 0;
6
    if (auto_length == 0)
7
    {
8
        init = 1;
9
        reformatted = 1;
10
    }
11
    if (reformatted == 0)
12
    {
13
        if (mywriter.formatted == 1)
14
        {
15
            if (init == 0)
16
            {
17
                initwritingx = mywriter.writingx;
18
                initwritingy = mywriter.writingy;
19
                init = 1;
20
            }
21
            writingx = mywriter.writingx;
22
            writingy = mywriter.writingy;
23
            stringmax = mywriter.stringmax;
24
            hspace = mywriter.hspace;
25
            vspace = mywriter.vspace;
26
            linecount = mywriter.linecount;
27
            balloonwidth = (stringmax * hspace) + 10;
28
            balloonheight = ((linecount + 1) * vspace) + 5;
29
            if (global.lang == "ja")
30
            {
31
                var checkstring = mywriter.mystring;
32
                var spacing = mywriter.hspace;
33
                var stringlength = string_length(checkstring);
34
                var newmaxlength = 0;
35
                var currentlength = 0;
36
                for (var ii = 1; ii < (stringlength + 1); ii += 1)
37
                {
38
                    var mychar = string_char_at(checkstring, ii);
39
                    if (mychar == "&" || mychar == "\n")
40
                    {
41
                        currentlength = 0;
42
                    }
43
                    else if (mychar == "^" || mychar == "*")
44
                    {
45
                        ii++;
46
                    }
47
                    else if (mychar == "\\")
48
                    {
49
                        ii += 2;
50
                    }
51
                    else if (mychar == "/" || mychar == "%")
52
                    {
53
                    }
54
                    else if (ord(mychar) < 256 || (ord(mychar) >= 65377 && ord(mychar) <= 65439))
55
                    {
56
                        currentlength += (spacing * 0.5);
57
                    }
58
                    else
59
                    {
60
                        currentlength += spacing;
61
                    }
62
                    if (currentlength >= newmaxlength)
63
                        newmaxlength = currentlength;
64
                }
65
                balloonwidth = newmaxlength + 10;
66
            }
67
            if (side == 1)
68
            {
69
                mywriter.writingx = initwritingx - (balloonwidth + 20);
70
                mywriter.writingy = initwritingy - (balloonheight / 2);
71
                writingx = initwritingx - (balloonwidth + 20);
72
                writingy = initwritingy - (balloonheight / 2);
73
            }
74
            if (side == -1)
75
            {
76
                xoffset = 20;
77
                mywriter.writingx = initwritingx;
78
                mywriter.writingy = initwritingy - (balloonheight / 2);
79
                writingx = initwritingx;
80
                writingy = initwritingy - (balloonheight / 2);
81
            }
82
        }
83
    }
84
    if (auto_length == 0)
85
        draw_self();
86
    if (auto_length == 1 && init == 1)
87
    {
88
        blconscale = 1;
89
        if (balloonheight < 40)
90
            blconscale = 0.5;
91
        if (side == 1)
92
            draw_sprite_ext(spr_battleblcon_parts, 4, x, y, 1, blconscale, 0, c_white, 1);
93
        if (side == -1)
94
            draw_sprite_ext(spr_battleblcon_parts, 4, x - xoffset, y, -1, blconscale, 0, c_white, 1);
95
        draw_set_color(c_white);
96
        draw_rectangle(writingx - 10, writingy - 5, writingx + balloonwidth, (writingy + balloonheight) - 5, false);
97
        draw_rectangle(writingx - 5, writingy - 10, (writingx + balloonwidth) - 5, writingy + balloonheight, false);
98
    }
99
    remmsgno = mywriter.msgno;
100
}