Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_rotating_kris_controller_new_Draw_0

(view raw script w/o annotations or w/e)
1
if (i_ex(obj_climb_kris) && i_ex(obj_rotating_tower_controller_new))
2
{
3
    if (obj_climb_kris.visible == 0)
4
        exit;
5
    depth = startdepth;
6
    with (obj_climb_mover)
7
    {
8
        if (con == 2)
9
        {
10
            other.depth = 1000;
11
            var tower = 1010;
12
            var adjustment = 0;
13
            var _tilex = (x / tower.tile_width_fine) + adjustment;
14
            if (_tilex > (tower.horizontaltilecount - 1))
15
                _tilex -= (tower.horizontaltilecount - 1);
16
            if (_tilex < 0)
17
                _tilex += (tower.horizontaltilecount - 1);
18
            var xoff = x % tower.tile_width_fine;
19
            if (tower.tile_vis[_tilex] == 1)
20
                draw_sprite_ext(sprite_index, image_index, tower.tower_x + xoff + tower.tile_x[_tilex], y, (tower.tile_xscale[_tilex] / tower.tile_width_fine) * image_xscale, image_yscale, 0, tower.tile_color[_tilex], 1);
21
            break;
22
        }
23
    }
24
    with (obj_rotating_tower_controller_new)
25
    {
26
        var _alph;
27
        if (obj_climb_kris.jumpchargecon)
28
        {
29
            var count = obj_climb_kris.jumpchargeamount;
30
            px = obj_climb_kris.x;
31
            py = obj_climb_kris.y;
32
            found = 0;
33
            for (reticle_i = 1; reticle_i < (count + 1); reticle_i++)
34
            {
35
                if (obj_climb_kris.dir == 0)
36
                    py = obj_climb_kris.y + (40 * reticle_i);
37
                if (obj_climb_kris.dir == 1)
38
                    px = obj_climb_kris.x + (40 * reticle_i);
39
                if (obj_climb_kris.dir == 2)
40
                    py = obj_climb_kris.y - (40 * reticle_i);
41
                if (obj_climb_kris.dir == 3)
42
                    px = obj_climb_kris.x - (40 * reticle_i);
43
                if (px < 0)
44
                    px += tower_circumference;
45
                if (px >= tower_circumference)
46
                    px -= tower_circumference;
47
                with (obj_climb_kris)
48
                {
49
                    if (place_meeting(other.px, other.py, obj_climb_climbable))
50
                        other.found = other.reticle_i;
51
                }
52
            }
53
            _alph = clamp(obj_climb_kris.jumpchargetimer / 14, 0.1, 0.8);
54
            px = obj_climb_kris.x;
55
            if (appearance == 1)
56
                px += 40;
57
            py = obj_climb_kris.y - 20;
58
            var _tilex = px / tile_width_fine;
59
            var _tiley = py / tile_height_fine;
60
            if (_tilex >= horizontaltilecount)
61
                _tilex -= horizontaltilecount;
62
            if (_tilex < 0)
63
                _tilex += horizontaltilecount;
64
            var angle = 0;
65
            var xoff = 0;
66
            var yoff = 0;
67
            var shiftX = 0;
68
            var shiftY = 0;
69
            if (obj_climb_kris.dir == 0)
70
            {
71
                angle = 0;
72
                xoff = -22;
73
                yoff = 18;
74
                shiftY = 1;
75
            }
76
            if (obj_climb_kris.dir == 1)
77
            {
78
                angle = 90;
79
                xoff = 18;
80
                yoff = 22;
81
                shiftX = 1;
82
            }
83
            if (obj_climb_kris.dir == 2)
84
            {
85
                angle = 180;
86
                xoff = 22;
87
                yoff = -18;
88
                shiftY = -1;
89
            }
90
            if (obj_climb_kris.dir == 3)
91
            {
92
                angle = 270;
93
                xoff = -18;
94
                yoff = -22;
95
                shiftX = -1;
96
            }
97
            var col = 8388736;
98
            var startArray = [0, 21, 41];
99
            var widthArray = [21, 20, 21];
100
            var totalStartX = (tower_x + tile_x[_tilex] + xoff) - 20;
101
            var totalWidth = (obj_climb_kris.jumpchargetimer / obj_climb_kris.chargetime2) * 62;
102
            count = 3;
103
            var divisor = 120;
104
            if (obj_rotating_tower_controller_new.appearance == 1)
105
            {
106
                count = 6;
107
                startArray = [0, 11, 21, 31, 41, 51];
108
                widthArray = [11, 10, 10, 10, 10, 11];
109
            }
110
            for (subsection = 0; subsection < count; subsection++)
111
            {
112
                var tilex = _tilex + ((subsection + 1) * shiftX);
113
                var tiley = _tiley + ((subsection + 1) * shiftY);
114
                if (tilex >= horizontaltilecount)
115
                    tilex -= horizontaltilecount;
116
                if (tilex < 0)
117
                    tilex += horizontaltilecount;
118
                if (tile_vis[tilex] == 0)
119
                    continue;
120
                var scaleMultiplier = tile_xscale[tilex] / tile_width_fine;
121
                var sourceX = startArray[subsection];
122
                var sourceWidth = widthArray[subsection];
123
                col = obj_climb_kris.reticle_hint_col_inactive;
124
                if (found)
125
                    col = obj_climb_kris.reticle_hint_col_active;
126
                var jankfix = 0;
127
                if (subsection == (count - 1) && tile_width_fine != tile_width && shiftX == -1)
128
                    jankfix = (6 * (shiftX - 1)) / 2;
129
                draw_sprite_general(spr_climb_reticle_hint, floor(current_time * 0.5) % 4, 0, sourceX, 22, clamp(totalWidth - sourceX, 0, sourceWidth), totalStartX - jankfix, py + yoff + 20 + (subsection * shiftY * (divisor / count)), 2, scaleMultiplier * -2, angle, col, col, col, col, _alph * 0.85);
130
                totalStartX += (scaleMultiplier * shiftX * sourceWidth * -2);
131
            }
132
        }
133
        var tempalpha = 1;
134
        if (global.inv > 0)
135
            tempalpha = 0.5;
136
        draw_sprite_ext(obj_climb_kris.sprite_index, obj_climb_kris.image_index, krisx - camerax(), krisy, obj_climb_kris.image_xscale, obj_climb_kris.image_yscale, obj_climb_kris.image_angle, obj_climb_kris.image_blend, tempalpha);
137
        if (obj_climb_kris.flashcon == 1)
138
        {
139
            obj_climb_kris.flashsiner += obj_climb_kris.flashspeed;
140
            d3d_set_fog(true, c_white, 0, 1);
141
            draw_sprite_ext(obj_climb_kris.sprite_index, obj_climb_kris.image_index, krisx - camerax(), krisy, obj_climb_kris.image_xscale, obj_climb_kris.image_yscale, obj_climb_kris.image_angle, obj_climb_kris.image_blend, tempalpha);
142
            d3d_set_fog(false, c_black, 0, 0);
143
            if (obj_climb_kris.flashsiner > 4 && sin(obj_climb_kris.flashsiner / 3) < 0)
144
            {
145
                obj_climb_kris.flashcon = 0;
146
                obj_climb_kris.flashsiner = 0;
147
            }
148
        }
149
        if (obj_climb_kris.jumpchargecon && found > 0)
150
        {
151
            px = obj_climb_kris.x;
152
            if (appearance == 1)
153
                px += 40;
154
            py = obj_climb_kris.y - 20;
155
            if (obj_climb_kris.dir == 0)
156
                py += (tile_height * found);
157
            if (obj_climb_kris.dir == 1)
158
                px += (tile_width * found);
159
            if (obj_climb_kris.dir == 2)
160
                py -= (tile_height * found);
161
            if (obj_climb_kris.dir == 3)
162
                px -= (tile_width * found);
163
            var _tilex = px / tile_width_fine;
164
            var _tiley = py / tile_height_fine;
165
            if (_tilex >= horizontaltilecount)
166
                _tilex -= horizontaltilecount;
167
            if (_tilex < 0)
168
                _tilex += horizontaltilecount;
169
            var col = merge_color(c_yellow, c_white, 0.4 + (sin(obj_climb_kris.jumpchargetimer / 3) * 0.4));
170
            if (tile_vis[_tilex] == 1)
171
                draw_sprite_ext(spr_climb_reticle, 0, tower_x + tile_x[_tilex], py, (tile_xscale[_tilex] / tile_width_fine) * 2, 2, 0, col, _alph);
172
        }
173
    }
174
}
175
with (obj_rotating_tower_controller_new)
176
{
177
    with (obj_bell_small_playable)
178
    {
179
        var _tilex = x / other.tile_width_fine;
180
        if (_tilex > (other.horizontaltilecount - 1))
181
            _tilex -= (other.horizontaltilecount - 1);
182
        if (_tilex < 0)
183
            _tilex += (other.horizontaltilecount - 1);
184
        var xscale = 2;
185
        var xx = other.tower_x + (other.tile_x[_tilex] * 1.25);
186
        var col = other.tile_color[_tilex];
187
        if (other.tile_vis[_tilex] == 1)
188
        {
189
            draw_sprite_ext(spr_pxwhite, 0, xx, y, xscale, -bellcordlength, 0, #B4D6CA, 1);
190
            draw_sprite_ext(spr_whitegradientdown_40, 0, xx, y - bellcordlength - (40 * bellcordfadelength), xscale / 40, bellcordfadelength, 0, #B4D6CA, 1);
191
            draw_sprite_ext(sprite_index, image_index, xx, y, xscale, 2, 0, col, 1);
192
        }
193
    }
194
}