Deltarune script viewer

← back to main script listing

gml_GlobalScript_scr_84_draw_menu

(view raw script w/o annotations or w/e)
1
function scr_84_draw_menu
scr_84_draw_menu

function scr_84_draw_menu(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { var array = arg0; var xx = arg1; var yy = arg2; var vspacing = arg3; var selection_indices = arg4; var func_depth = arg5; var menu_depth = arg6; var length = ds_list_size(array); for (var i = 0; i < length; i += 3) { var ndx = i / 3; var type = ds_list_find_value(array, i); var item = ds_list_find_value(array, i + 1); var name = ds_list_find_value(array, i + 2); var selected = false; var prefix = " "; if (ndx == selection_indices[func_depth]) selected = true; draw_set_colour(c_white); if (selected) { draw_set_colour(c_yellow); prefix = "> "; if (func_depth > global.chemg_max_depth) { global.chemg_max_depth = func_depth; global.chemg_cursor_y = yy; } } if (type == "[group]") name = "[ " + name + "... ]"; scr_84_draw_text_outline(xx, yy, prefix + name); yy += vspacing; if (func_depth < menu_depth && ndx == selection_indices[func_depth]) yy = scr_84_draw_menu(item, xx + 20, yy, vspacing, selection_indices, func_depth + 1, menu_depth); } return yy; }
(arg0, arg1, arg2, arg3, arg4, arg5, arg6)
2
{
3
    var array = arg0;
4
    var xx = arg1;
5
    var yy = arg2;
6
    var vspacing = arg3;
7
    var selection_indices = arg4;
8
    var func_depth = arg5;
9
    var menu_depth = arg6;
10
    var length = ds_list_size(array);
11
    for (var i = 0; i < length; i += 3)
12
    {
13
        var ndx = i / 3;
14
        var type = ds_list_find_value(array, i);
15
        var item = ds_list_find_value(array, i + 1);
16
        var name = ds_list_find_value(array, i + 2);
17
        var selected = false;
18
        var prefix = "  ";
19
        if (ndx == selection_indices[func_depth])
20
            selected = true;
21
        draw_set_colour(c_white);
22
        if (selected)
23
        {
24
            draw_set_colour(c_yellow);
25
            prefix = "> ";
26
            if (func_depth > global.chemg_max_depth)
27
            {
28
                global.chemg_max_depth = func_depth;
29
                global.chemg_cursor_y = yy;
30
            }
31
        }
32
        if (type == "[group]")
33
            name = "[ " + name + "... ]";
34
        scr_84_draw_text_outline
scr_84_draw_text_outline

function scr_84_draw_text_outline(arg0, arg1, arg2) { var xx = arg0; var yy = arg1; var str = arg2; var __txtcolor__ = draw_get_color(); draw_set_colour(c_black); draw_text(xx - 1, yy - 1, str); draw_text(xx + 1, yy - 1, str); draw_text(xx - 1, yy + 1, str); draw_text(xx + 1, yy + 1, str); draw_set_colour(__txtcolor__); draw_text(xx, yy, str); }
(xx, yy, prefix + name);
35
        yy += vspacing;
36
        if (func_depth < menu_depth && ndx == selection_indices[func_depth])
37
            yy = scr_84_draw_menu
scr_84_draw_menu

function scr_84_draw_menu(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { var array = arg0; var xx = arg1; var yy = arg2; var vspacing = arg3; var selection_indices = arg4; var func_depth = arg5; var menu_depth = arg6; var length = ds_list_size(array); for (var i = 0; i < length; i += 3) { var ndx = i / 3; var type = ds_list_find_value(array, i); var item = ds_list_find_value(array, i + 1); var name = ds_list_find_value(array, i + 2); var selected = false; var prefix = " "; if (ndx == selection_indices[func_depth]) selected = true; draw_set_colour(c_white); if (selected) { draw_set_colour(c_yellow); prefix = "> "; if (func_depth > global.chemg_max_depth) { global.chemg_max_depth = func_depth; global.chemg_cursor_y = yy; } } if (type == "[group]") name = "[ " + name + "... ]"; scr_84_draw_text_outline(xx, yy, prefix + name); yy += vspacing; if (func_depth < menu_depth && ndx == selection_indices[func_depth]) yy = scr_84_draw_menu(item, xx + 20, yy, vspacing, selection_indices, func_depth + 1, menu_depth); } return yy; }
(item, xx + 20, yy, vspacing, selection_indices, func_depth + 1, menu_depth);
38
    }
39
    return yy;
40
}