Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dialogue_nongui_Draw_0

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