Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_choicer_neo_Step_0

(view raw script w/o annotations or w/e)
1
global.flag[33 choice_time_taken] += 1;
2
if (canchoose == 1)
3
{
4
    if (mychoice >= 0 && button1_p())
5
        event_user(0);
6
    if (choiced == 0)
7
    {
8
        if (left_h())
9
            mychoice = 0;
10
        if (choicetotal >= 1 && right_h())
11
            mychoice = 1;
12
        if (choicetotal >= 2 && up_h())
13
            mychoice = 2;
14
        if (choicetotal >= 3 && down_h())
15
            mychoice = 3;
16
    }
17
}
18
scr_84_set_draw_font
scr_84_set_draw_font

function
scr_84_set_draw_font(arg0)
{ global.chemg_font = arg0; draw_set_font(
scr_84_get_font(arg0));
}
((dar == 1) ? "main" : "mainbig");
19
if (choicerstyle == 1)
20
    
scr_84_set_draw_font
scr_84_set_draw_font

function
scr_84_set_draw_font(arg0)
{ global.chemg_font = arg0; draw_set_font(
scr_84_get_font(arg0));
}
("8bit");
21
if (neostyle == 0)
22
{
23
    if (choicerstyle == 0)
24
    {
25
        heartposx[0] = xx + (30 * dar);
26
        heartposy[0] = yy + ((34 + d_add) * dar) + (fighting * 30);
27
        textposx[0] = heartposx[0] + (16 * dar);
28
        textposy[0] = yy + ((13 + d_add) * dar) + (fighting * 30);
29
        if (choicetotal >= 1)
30
        {
31
            var str1width = string_width(string_hash_to_newline(global.choicemsg[1]));
32
            heartposx[1] = (xx + (276 * dar)) - str1width;
33
            heartposy[1] = yy + ((34 + d_add) * dar) + (fighting * 30);
34
            textposx[1] = heartposx[1] + (16 * dar);
35
            textposy[1] = yy + ((13 + d_add) * dar) + (fighting * 30);
36
        }
37
        if (choicetotal >= 2)
38
        {
39
            var msg0right = heartposx[0] + (16 * dar) + string_width(string_hash_to_newline(global.choicemsg[0]));
40
            var msg1left = heartposx[1];
41
            var msg2width = string_width(string_hash_to_newline(global.choicemsg[2])) + (16 * dar);
42
            if (choicetotal == 3)
43
            {
44
                var msg3width = string_width(string_hash_to_newline(global.choicemsg[3])) + (16 * dar);
45
                if (msg3width > msg2width)
46
                    msg2width = msg3width;
47
            }
48
            heartposx[2] = (msg0right + ((msg1left - msg0right) / 2)) - (msg2width / 2);
49
            heartposy[2] = yy + ((16 + d_add) * dar) + (fighting * 30);
50
            textposx[2] = heartposx[2] + (16 * dar);
51
            textposy[2] = yy + ((13 + d_add) * dar) + (fighting * 30);
52
        }
53
        if (choicetotal >= 3)
54
        {
55
            heartposx[3] = heartposx[2];
56
            heartposy[3] = yy + ((60 + d_add) * dar) + (fighting * 30);
57
            textposx[3] = heartposx[3] + (16 * dar);
58
            textposy[3] = yy + ((56 + d_add) * dar) + (fighting * 30);
59
        }
60
        if (mychoice >= 0)
61
        {
62
            hx = heartposx[mychoice];
63
            hy = heartposy[mychoice];
64
        }
65
    }
66
    if (choicerstyle == 1)
67
    {
68
        xx = boardwriter.x;
69
        yy = boardwriter.y;
70
    }
71
}
72
if (neostyle == 1)
73
{
74
    var scale = dar;
75
    if (!neoinit)
76
    {
77
        hx = xx + (156 * scale) + heartxoff;
78
        hy = yy + ((38 + d_add) * scale) + heartyoff;
79
        var textyoff = -1.5;
80
        textposx = [77.5 + opt0xoff, 243.5 + opt1xoff, 160.5 + opt2xoff, 163.5 + opt3xoff];
81
        textposy = [43 + opt0yoff, 43 + opt1yoff, 23 + opt2yoff, 62.5 + opt3yoff];
82
        for (var i = 0; i < 4; i++)
83
        {
84
            if (string_char_at(global.choicemsg[i], 0) == "#")
85
                global.choicemsg[i] = string_copy(global.choicemsg[i], 2, string_length(global.choicemsg[i]));
86
            textposx[i] = xx + (textposx[i] * scale);
87
            textposy[i] = yy + ((textposy[i] + d_add + textyoff) * scale);
88
            var biggest = 0;
89
            var arraySplit = string_split(global.choicemsg[i], "#", true, 20);
90
            neolinecount[i] = array_length(arraySplit);
91
            for (var w = 0; w < neolinecount[i]; w++)
92
            {
93
                var newline = string_width(arraySplit[w]);
94
                biggest = max(biggest, newline);
95
            }
96
            if (i == 2)
97
            {
98
                if (neolinecount[i] > 1)
99
                {
100
                    textposy[i] += 2 * scale;
101
                    hy += (2.5 * scale);
102
                }
103
            }
104
            var heartSize = 11 * scale;
105
            var textXoff = round(biggest / 2) + heartSize;
106
            heartposx[i] = textposx[i] - textXoff;
107
            heartposy[i] = textposy[i];
108
        }
109
        if (choicetotal == 3)
110
        {
111
            if (neolinecount[2] == 1 && neolinecount[3] == 2)
112
                hy -= (5.5 * scale);
113
            if (neolinecount[2] == 2 && neolinecount[3] == 1)
114
                hy += (1.5 * scale);
115
            if (neolinecount[2] == 2 && neolinecount[3] == 2)
116
                hy -= (2 * scale);
117
        }
118
        var placeheart = false;
119
        if (left_h())
120
        {
121
            mychoice = 0;
122
            placeheart = true;
123
        }
124
        else if (right_h())
125
        {
126
            mychoice = 1;
127
            placeheart = true;
128
        }
129
        else if (up_h() && choicetotal > 1)
130
        {
131
            mychoice = 2;
132
            placeheart = true;
133
        }
134
        else if (down_h() && choicetotal > 2)
135
        {
136
            mychoice = 3;
137
            placeheart = true;
138
        }
139
        if (placeheart)
140
        {
141
            hx = heartposx[mychoice];
142
            hy = heartposy[mychoice];
143
        }
144
        neoinit = 1;
145
    }
146
    if (mychoice >= 0)
147
    {
148
        hx = lerp(hx, heartposx[mychoice], neolerpstrength);
149
        hy = lerp(hy, heartposy[mychoice] - (4 * scale), neolerpstrength);
150
    }
151
}