Undertale Yellow script viewer

← back to main script listing

gml_Object_obj_dialogue_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
if (position == 0)
8
    yy = 160
9
else
10
    yy = 5
11
var xx = 30
12
if (portrait == true)
13
    xx = 88
14
var portrait_xx = 52
15
var line_sep = 18
16
scr_draw_dialogue_box
scr_draw_dialogue_box

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