Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dialogue_battle_asgore_Draw_64

(view raw script w/o annotations or w/e)
1
if live_call()
2
    return global.live_result;
3
if (message_current > (array_length_1d(prt) - 1) || prt[message_current] == spr_collisionbox)
4
    portrait = false
5
else
6
    portrait = true
7
yy = 5
8
var xx = 30
9
if (portrait == true)
10
    xx = 88
11
var portrait_xx = 52
12
var line_sep = 18
13
draw_set_font(dialogue_font)
14
draw_set_color(c_white)
15
draw_set_halign(fa_left)
16
message_actual = string_copy(message[message_current], 0, cutoff)
17
if (portrait == true)
18
{
19
    if (cutoff < string_length(message[message_current]) && portrait_can_animate == true)
20
        var prt_animate = -1
21
    else
22
        prt_animate = 0
23
    var portrait_y_disjoint = yy + sprite_get_height(prt[message_current]) / 3 + 28
24
    draw_sprite_ext(prt[message_current], prt_animate, portrait_xx, portrait_y_disjoint, 0.5, 0.5, 0, c_white, 1)
25
    if (prt_animate == 0)
26
    {
27
        switch prt[message_current]
28
        {
29
            case 343:
30
                if (portrait_idle_animated == spr_collisionbox && irandom(40) == 1)
31
                {
32
                    portrait_idle_animated = toriel_blink
33
                    portrait_idle_frame = 0
34
                }
35
                if (portrait_idle_animated != spr_collisionbox)
36
                {
37
                    draw_sprite_ext(portrait_idle_animated, portrait_idle_frame, portrait_xx, portrait_y_disjoint, 0.5, 0.5, 0, c_white, 1)
38
                    portrait_idle_frame += 0.2
39
                }
40
                if (portrait_idle_frame >= sprite_get_number(portrait_idle_animated))
41
                {
42
                    portrait_idle_animated = 0
43
                    portrait_idle_frame = 0
44
                }
45
                break
46
        }
47
48
    }
49
}
50
draw_text_ext(xx, (yy + 10), string_hash_to_newline(message_actual), line_sep, -1)
51
if (color == true)
52
{
53
    if (color_set == false)
54
    {
55
        for (var i = 0; i < (array_length_1d(message) - 1); i++)
56
        {
57
            var len = array_length_2d(message_col, i)
58
            if (len == 0)
59
                message_col[i][0] = ""
60
            else if (len > 0)
61
            {
62
                for (var j = 0; j < (array_length_1d(col_modif) - 1); j++)
63
                {
64
                    if (j < array_length_2d(message_col, i) && message_col[i][j] == 0)
65
                        message_col[i][j] = ""
66
                }
67
            }
68
        }
69
        color_set = true
70
    }
71
    for (j = 0; j < array_length_2d(message_col, message_current); j++)
72
    {
73
        message_actual_col[j] = string_copy(message_col[message_current][j], 0, cutoff)
74
        draw_set_color(col_modif[j])
75
        draw_text_ext(xx, (yy + 10), string_hash_to_newline(message_actual_col[j]), line_sep, -1)
76
    }
77
}
78
draw_set_color(c_white)
79
if (dialogue_is_minishop == true)
80
{
81
    var minishop_box_xx = 204
82
    var minishop_box_yy = 92
83
    draw_set_color(c_white)
84
    draw_rectangle(minishop_box_xx, minishop_box_yy, (minishop_box_xx + 100), (minishop_box_yy + 53), false)
85
    draw_set_color(c_black)
86
    draw_rectangle((minishop_box_xx + 3), (minishop_box_yy + 3), (minishop_box_xx + 100 - 3), (minishop_box_yy + 53 - 3), false)
87
    draw_set_font(fnt_battle)
88
    draw_set_color(c_white)
89
    var item_count = 1
90
    while (item_count <= 8)
91
    {
92
        if (global.item_slot[item_count] == "Nothing")
93
            break
94
        else
95
        {
96
            item_count++
97
            continue
98
        }
99
    }
100
    draw_text(217, 100, string_hash_to_newline("$ - " + string(global.player_gold) + "#SPACE - " + (string(item_count - 1)) + "/8"))
101
}
102
if (choice == false)
103
    return;
104
xx = 100
105
var spacing = 0.25
106
if (ch[4] != "")
107
    spacing = 0.5
108
if portrait
109
    spacing = 0.15
110
if (position == 0)
111
{
112
    var ypos1 = 190
113
    if (ch[3] == "")
114
        ypos1 = 210
115
    var ypos2 = 210
116
}
117
else
118
{
119
    ypos1 = 32
120
    if (ch[3] == "")
121
        ypos1 = 56
122
    ypos2 = 56
123
}
124
if (ch[4] != "")
125
    xx -= 30
126
var xpos1 = xx
127
var xpos2 = xx + 122
128
if (portrait == true)
129
    xpos1 += 20
130
var xpos3 = xpos1
131
var xpos4 = xpos2
132
if (ch[2] == "")
133
    xpos1 = xpos1 + 56
134
if (ch[4] == "")
135
    xpos3 = xpos1 + 56
136
if (cutoff >= string_length(message[message_current]))
137
{
138
    draw_set_halign(fa_center)
139
    if (ch[4] != "")
140
        draw_set_halign(fa_left)
141
    draw_text(xpos1, ypos1, string_hash_to_newline(ch[1]))
142
    if (ch[2] != "")
143
        draw_text(xpos2, ypos1, string_hash_to_newline(ch[2]))
144
    if (ch[3] != "")
145
        draw_text(xpos3, ypos2, string_hash_to_newline(ch[3]))
146
    if (ch[4] != "")
147
        draw_text(xpos4, ypos2, string_hash_to_newline(ch[4]))
148
    draw_set_halign(fa_center)
149
    var soul_offset = string_width(string_hash_to_newline(ch[p])) * 0.5
150
    if (ch[4] != "")
151
        soul_offset = 0
152
    switch p
153
    {
154
        case 1:
155
            var soul_x = xpos1 - soul_offset - 8
156
            var soul_y = ypos1 + 8
157
            break
158
        case 2:
159
            soul_x = xpos2 - soul_offset - 8
160
            soul_y = ypos1 + 8
161
            break
162
        case 3:
163
            soul_x = xpos3 - soul_offset - 8
164
            soul_y = ypos2 + 8
165
            break
166
        case 4:
167
            soul_x = xpos4 - soul_offset - 8
168
            soul_y = ypos2 + 8
169
            break
170
    }
171
172
    draw_sprite(spr_heart_yellow_overworld, 0, soul_x, soul_y)
173
}
174
draw_set_halign(fa_left)