Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_tvturnoff_manager_Draw_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    if (kind == 0)
4
        persistent = false;
5
    if (kind == 1)
6
    {
7
        global.interact = 3;
8
        with (obj_mainchara)
9
            freeze = true;
10
    }
11
    init = 1;
12
}
13
if (i_ex(obj_dialoguer))
14
    depth = obj_dialoguer.depth + 2;
15
with (obj_tenna_board4_enemy)
16
    depth = obj_tvturnoff_manager.depth + 1;
17
if (con > 0)
18
    draw_sprite_ext(spr_blank_tile_black, 0, camerax(), cameray(), 9999, 9999, 0, c_white, image_alpha);
19
if (con == 0)
20
{
21
    timer++;
22
    _alpha1 = lerp(0, 1, timer / 5);
23
    draw_sprite_ext(spr_zapper_tvturnoff1, 0, camerax() + 320, cameray() + 240 + yoff, 6, 10, 0, c_white, _alpha1);
24
    if (timer == 5)
25
    {
26
        if (i_ex(obj_tenna_board4_enemy))
27
        {
28
            with (obj_zapper_enemy)
29
                image_alpha = 0;
30
            with (obj_tenna_board4_enemy)
31
                hidetvcount = true;
32
            with (obj_actor_tenna)
33
                preset = 0;
34
        }
35
    }
36
    if (timer == 5)
37
    {
38
        con = 1;
39
        timer = 0;
40
    }
41
}
42
if (con == 1)
43
{
44
    timer++;
45
    if (timer == 4)
46
        snd_play(snd_tvturnoff);
47
    _yscale1 = lerp(_yscale1, 0.05, timer / 8);
48
    draw_sprite_ext(spr_zapper_tvturnoff1, 0, camerax() + 320, cameray() + 240 + yoff, 6, _yscale1, 0, c_white, 1);
49
    draw_sprite_ext(spr_zapper_tvturnoff2, 2, camerax() + 320, cameray() + 240 + yoff, 0.1, 0.1, 0, c_white, 1);
50
    if (timer == 8)
51
    {
52
        con = 2;
53
        timer = 0;
54
        snd_play(snd_tvturnoff2);
55
        if (kind == 0)
56
            audio_pause_sound(global.batmusic[1]);
57
        if (kind == 1 || kind == 2)
58
            audio_pause_sound(global.currentsong[1]);
59
    }
60
}
61
if (con == 2)
62
{
63
    timer++;
64
    var timing = 10;
65
    if (timer <= timing)
66
    {
67
        _xscale1 = lerp(_xscale1, 0, timer / timing);
68
        _yscale1 = lerp(_yscale1, 0.01, timer / timing);
69
    }
70
    timer2++;
71
    var timing2 = 5;
72
    if (timer2 <= timing2)
73
    {
74
        _xscale2 = lerp(_xscale2, 0.4, timer2 / timing2);
75
        _yscale2 = lerp(_yscale2, 0.4, timer2 / timing2);
76
    }
77
    else
78
    {
79
        _xscale2 = lerp(_xscale2, 0, (timer2 - timing2) / timing2);
80
        _yscale2 = lerp(_yscale2, 0, (timer2 - timing2) / timing2);
81
    }
82
    draw_sprite_ext(spr_zapper_tvturnoff1, 0, camerax() + 320, cameray() + 240 + yoff, _xscale1, _yscale1, 0, c_white, 1);
83
    draw_sprite_ext(spr_zapper_tvturnoff2, 2, camerax() + 320, cameray() + 240 + yoff, _xscale2, _yscale2, 0, c_white, 1);
84
    if (timer == 30)
85
    {
86
        con = 3;
87
        timer = 0;
88
        if (i_ex(obj_lightemup_controller))
89
        {
90
            with (obj_battlecontroller)
91
                skipvictory = 1;
92
            
scr_wincombat
scr_wincombat

function
scr_wincombat()
{ if (global.flag[60 dojo_next_encounter] == 0 || global.flag[36 dojo_failure] == 1) { global.myfight = 7; global.mnfight = -1; with (obj_battlecontroller) victory = 1; for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } } else { for (i = 0; i < 3; i += 1) { if (global.monster[i] == 1 && i_ex(global.monsterinstance[i])) { with (global.monsterinstance[i])
scr_monsterdefeat();
} } global.encounterno = global.flag[60 dojo_next_encounter];
scr_encountersetup(global.encounterno);
global.flag[60 dojo_next_encounter] = 0; for (__j = 0; __j < 3; __j++) { if (global.monstertype[__j] != 0(None)) { _newmonster =
scr_monster_add(global.monstertype[__j], global.monsterinstancetype[__j]);
global.monsterinstance[_newmonster].x = camerax() + 800; global.monsterinstance[_newmonster].y = global.monstermakey[__j]; with (global.monsterinstance[_newmonster])
scr_move_to_point_over_time(global.monstermakex[myself], global.monstermakey[myself], 10);
} } global.myfight = 5; myfightreturntimer = 15; global.mnfight = -1; } }
();
93
            with (obj_shadowman_sharpshoot_target)
94
                instance_destroy();
95
            with (obj_screen_channel_change)
96
            {
97
                is_finished = true;
98
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(id, 30);
99
            }
100
            with (obj_lightemup_controller)
101
                instance_destroy();
102
            with (obj_shadowman_sharpshoot_heart)
103
                instance_destroy();
104
            with (obj_tenna_enemy)
105
                instance_destroy();
106
            image_alpha = 6;
107
        }
108
        if (kind == 1)
109
        {
110
            if (entrance != "none")
111
                global.entrance = entrance;
112
            if (facing != -1)
113
                global.facing = facing;
114
            if (room_exists(roomtarg))
115
            {
116
                global.interact = 3;
117
                if (room == room_dw_b3bs_zapper_c)
118
                    snd_stop(global.currentsong[1]);
119
                if (roomtarg == 182)
120
                    
scr_setparty
scr_setparty

function
scr_setparty(arg0, arg1, arg2)
{ var kris = obj_mainchara; var slot = 0; var __make = true; if (!i_ex(kris)) __make = false;
scr_losechar();
safe_delete(obj_caterpillarchara); if (arg0 == true) {
scr_getchar(2);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 2, slot))
{ halign = (global.darkzone == 0) ? 3 : 6; valign = (global.darkzone == 0) ? 6 : 16; x -= halign; y -= valign; } } slot++; } if (arg1 == true) {
scr_getchar(3);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 3, slot))
{ halign = 2; valign = 12; x -= halign; y -= valign; } } slot++; } if (arg2 == true) {
scr_getchar(4);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 4, slot))
{ halign = (global.darkzone == 0) ? 2 : 4; valign = (global.darkzone == 0) ? 9 : 18; x -= halign; y -= valign; } } slot++; } }
(0, 0, 0);
121
                else
122
                    
scr_setparty
scr_setparty

function
scr_setparty(arg0, arg1, arg2)
{ var kris = obj_mainchara; var slot = 0; var __make = true; if (!i_ex(kris)) __make = false;
scr_losechar();
safe_delete(obj_caterpillarchara); if (arg0 == true) {
scr_getchar(2);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 2, slot))
{ halign = (global.darkzone == 0) ? 3 : 6; valign = (global.darkzone == 0) ? 6 : 16; x -= halign; y -= valign; } } slot++; } if (arg1 == true) {
scr_getchar(3);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 3, slot))
{ halign = 2; valign = 12; x -= halign; y -= valign; } } slot++; } if (arg2 == true) {
scr_getchar(4);
if (__make) { with (
scr_makecaterpillar(kris.x, kris.y, 4, slot))
{ halign = (global.darkzone == 0) ? 2 : 4; valign = (global.darkzone == 0) ? 9 : 18; x -= halign; y -= valign; } } slot++; } }
(1, 1, 0);
123
                room_goto(roomtarg);
124
            }
125
        }
126
        if (kind == 2)
127
        {
128
            obj_mainchara.x = 
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(targx);
129
            obj_mainchara.y = 
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(targy);
130
            if (kind == 2)
131
                global.facing = 1;
132
            with (obj_caterpillarchara)
133
            {
134
                setxy(
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(obj_mainchara.x - 10),
scr_even
scr_even

function
scr_even(arg0)
{ return round(arg0 / 2) * 2; }
(obj_mainchara.y - 16));
135
                if (name == "susie")
136
                {
137
                    x -= 12;
138
                    y -= 16;
139
                }
140
                else
141
                {
142
                    x -= 20;
143
                    y += 14;
144
                }
145
                
scr_caterpillar_interpolate
scr_caterpillar_interpolate

function
scr_caterpillar_interpolate()
{ _newfacing =
scr_facing_letter_to_number(
scr_get_cardinal_direction(point_direction(x, y, obj_mainchara.x, obj_mainchara.y)));
remx[0] = obj_mainchara.x; remy[0] = obj_mainchara.y; facing[0] = _newfacing; for (_iaia = target; _iaia > 0; _iaia -= 1) { remx[_iaia] = lerp(obj_mainchara.x, x, _iaia / target); if (global.darkzone == 1) remy[_iaia] = lerp(obj_mainchara.y, y + 16, _iaia / target); else remy[_iaia] = lerp(obj_mainchara.y, y + 6, _iaia / target); facing[_iaia] = _newfacing; } }
();
146
                
scr_caterpillar_facing
scr_caterpillar_facing

function
scr_caterpillar_facing(arg0)
{ with (obj_caterpillarchara) { for (i = 0; i < 25; i += 1) facing[i] = arg0; } }
(1);
147
            }
148
        }
149
    }
150
}
151
if (con == 3)
152
{
153
    timer++;
154
    if (i_ex(obj_tenna_board4_enemy))
155
    {
156
        with (obj_heroparent)
157
            x = -9999;
158
    }
159
    if ((i_ex(obj_tenna_board4_enemy) && timer > 60) || !i_ex(obj_tenna_board4_enemy))
160
    {
161
        if (image_alpha == 1 && muted == 0)
162
        {
163
            if (kind == 0)
164
                audio_resume_sound(global.batmusic[1]);
165
            if (kind == 1)
166
            {
167
                mus_volume(global.currentsong[1], 0, 0);
168
                audio_resume_sound(global.currentsong[1]);
169
                mus_volume(global.currentsong[1], 1, 10);
170
            }
171
        }
172
        if (tennaending)
173
        {
174
            image_alpha = 1;
175
        }
176
        else
177
        {
178
            if (room == room_dw_snow_zone)
179
                image_alpha -= 0.04;
180
            else
181
                image_alpha -= 0.1;
182
            if (image_alpha < 0)
183
            {
184
                snd_stop(snd_tvturnoff2);
185
                instance_destroy();
186
                if (kind == 2)
187
                {
188
                    show_debug_message_concat("global interact set to zero by obj_tvturnoff_manager kind=2");
189
                    global.interact = 0;
190
                }
191
            }
192
        }
193
    }
194
}