Deltarune 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
                        currentlength = 0
41
                    else if (mychar == "^" || mychar == "*")
42
                        ii++
43
                    else if (mychar == "\\")
44
                        ii += 2
45
                    else if (mychar == "/" || mychar == "%")
46
                    {
47
                    }
48
                    else if (ord(mychar) < 256 || (ord(mychar) >= 65377 && ord(mychar) <= 65439))
49
                        currentlength += (spacing * 0.5)
50
                    else
51
                        currentlength += spacing
52
                    if (currentlength >= newmaxlength)
53
                        newmaxlength = currentlength
54
                }
55
                balloonwidth = newmaxlength + 10
56
            }
57
            if (side == 1)
58
            {
59
                mywriter.writingx = initwritingx - (balloonwidth + 20)
60
                mywriter.writingy = initwritingy - balloonheight / 2
61
                writingx = initwritingx - (balloonwidth + 20)
62
                writingy = initwritingy - balloonheight / 2
63
            }
64
            if (side == -1)
65
            {
66
                xoffset = 20
67
                mywriter.writingx = initwritingx
68
                mywriter.writingy = initwritingy - balloonheight / 2
69
                writingx = initwritingx
70
                writingy = initwritingy - balloonheight / 2
71
            }
72
        }
73
    }
74
    if (auto_length == 0)
75
        draw_self()
76
    if (auto_length == 1 && init == 1)
77
    {
78
        blconscale = 1
79
        if (balloonheight < 40)
80
            blconscale = 0.5
81
        if (side == 1)
82
            draw_sprite_ext(spr_battleblcon_parts, 4, x, y, 1, blconscale, 0, c_white, 1)
83
        if (side == -1)
84
            draw_sprite_ext(spr_battleblcon_parts, 4, (x - xoffset), y, -1, blconscale, 0, c_white, 1)
85
        draw_set_color(c_white)
86
        draw_rectangle((writingx - 10), (writingy - 5), (writingx + balloonwidth), (writingy + balloonheight - 5), false)
87
        draw_rectangle((writingx - 5), (writingy - 10), (writingx + balloonwidth - 5), (writingy + balloonheight), false)
88
    }
89
    remmsgno = mywriter.msgno
90
}