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