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