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