-
Notifications
You must be signed in to change notification settings - Fork 0
/
V-Bodhi-spi2.script
164 lines (126 loc) · 5.41 KB
/
V-Bodhi-spi2.script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
### Black Background
Window.SetBackgroundTopColor(0.18, 0.18, 0.18);
Window.SetBackgroundBottomColor(0.18, 0.18, 0.18);
//SpriteWindowSetBackgroundTopColor(255.00, 255.00, 255.00);
//SpriteWindowSetBackgroundBottomColor(255.00, 255.00, 255.00);
//SpriteWindowSetBackgroundTopColor(77.00, 77.00, 77.00);
//SpriteWindowSetBackgroundBottomColor(47.00, 53.00, 57.00);
logo.image = Image("bodhi_logo.png");
logo.sprite = Sprite(logo.image);
index = 0;
while (1){
index_string = index;
if (index < 10) index_string = "0" + index_string;
frame_image[index] = ImageNew("throbber-" + index_string + ".png");
if (!frame_image[index]) break;
index++;
}
frame_count = index + 1;
frame_index = 0;
throbber_sprite = SpriteNew();
fun refresh (){
if (status == "normal"){
frame_index += 20 / 50;
frame_index %= frame_count;
int_frame_index = MathInt(frame_index);
SpriteSetImage (throbber_sprite, frame_image[int_frame_index]);
SpriteSetX (throbber_sprite, SpriteWindowGetWidth() / 2 - ImageGetWidth(frame_image[int_frame_index]) / 2);
SpriteSetY (throbber_sprite, SpriteWindowGetHeight() / 2);
SpriteSetOpacity (throbber_sprite, 1);
SpriteSetX (logo.sprite, SpriteWindowGetWidth() / 2 - ImageGetWidth(logo.image) / 2);
SpriteSetY (logo.sprite, SpriteWindowGetHeight() / 2 - ImageGetHeight(logo.image));
SpriteSetOpacity (logo.sprite, 1);
}
else{
SpriteSetOpacity (throbber_sprite, 0);
SpriteSetX (logo.sprite, 0);
SpriteSetY (logo.sprite, 0);
}
}
PlymouthSetRefreshFunction (refresh);
//---------------------------------------Dialogue stuff --------------------------------
status = "normal";
fun dialogue_setup(){
local.box;
local.lock;
local.entry;
local.bullet_image;
box.image = ImageNew("box.png");
lock.image = ImageNew("lock.png");
entry.image = ImageNew("entry.png");
bullet_image = ImageNew("bullet.png");
box.sprite = SpriteNew();
SpriteSetImage(box.sprite, box.image);
box.x = SpriteWindowGetWidth() / 2 - ImageGetWidth (box.image)/2;
box.y = SpriteWindowGetHeight() / 2 - ImageGetHeight(box.image)/2;
box.z = 10000;
SpriteSetPosition(box.sprite, box.x, box.y, box.z);
lock.sprite = SpriteNew();
SpriteSetImage(lock.sprite, lock.image);
lock.x = box.x + ImageGetWidth(box.image)/2 - (ImageGetWidth(lock.image) + ImageGetWidth(entry.image)) / 2;
lock.y = box.y + ImageGetHeight(box.image)/2 - ImageGetHeight(lock.image)/2;
lock.z = box.z + 1;
SpriteSetPosition(lock.sprite, lock.x, lock.y, lock.z);
entry.sprite = SpriteNew();
SpriteSetImage(entry.sprite, entry.image);
entry.x = lock.x + ImageGetWidth(lock.image);
entry.y = box.y + ImageGetHeight(box.image)/2 - ImageGetHeight(entry.image)/2;
entry.z = box.z + 1;
SpriteSetPosition(entry.sprite, entry.x, entry.y, entry.z);
global.dialogue = local;
}
fun dialogue_opacity(opacity){
global.dialogue.opacity = opacity;
local = global.dialogue;
SpriteSetOpacity (box.sprite, opacity);
SpriteSetOpacity (lock.sprite, opacity);
SpriteSetOpacity (entry.sprite, opacity);
for (index = 0; bullet[index]; index++){
SpriteSetOpacity(bullet[index].sprite, opacity);
}
}
fun display_normal (){
global.status = "normal";
if (global.dialogue) dialogue_opacity (0);
}
PlymouthSetDisplayNormalFunction(display_normal);
fun display_password (prompt, bullets){
global.status = "password";
if (!global.dialogue) dialogue_setup();
dialogue_opacity (1);
for (index = 0; dialogue.bullet[index] || index < bullets; index++){
if (!dialogue.bullet[index]){
dialogue.bullet[index].sprite = SpriteNew();
SpriteSetImage(dialogue.bullet[index].sprite, dialogue.bullet_image);
dialogue.bullet[index].x = dialogue.entry.x + index * ImageGetWidth(dialogue.bullet_image);
SpriteSetX(dialogue.bullet[index].sprite, dialogue.bullet[index].x);
dialogue.bullet[index].y = dialogue.entry.y + ImageGetHeight(dialogue.entry.image) / 2 - ImageGetHeight(dialogue.bullet_image) / 2;
SpriteSetY(dialogue.bullet[index].sprite, dialogue.bullet[index].y);
dialogue.bullet[index].z = dialogue.entry.z + 1;
SpriteSetZ(dialogue.bullet[index].sprite, dialogue.bullet[index].z);
}
SpriteSetOpacity(dialogue.bullet[index].sprite, 0);
if (index < bullets){
SpriteSetOpacity(dialogue.bullet[index].sprite, 1);
}
}
}
PlymouthSetDisplayPasswordFunction(display_password);
//--------------------------------------Progress stuff --------------------------------
fun progress (duration, progress){
global.progress = progress;
}
PlymouthSetBootProgressFunction(progress);
//--------------------------------------- Quit --------------------------------
fun quit (){
logo.sprite.SetOpacity (1);
}
Plymouth.SetQuitFunction(quit);
//--------------------------------------- Message --------------------------------
sprite_prompt = SpriteNew();
fun display_message_callback (prompt) {
prompt = Image.Text(prompt,1.0, 1.0, 1.0);
sprite_prompt.SetImage(prompt);
sprite_prompt.SetPosition(Window.GetX() + (Window.GetWidth() - prompt.GetWidth()) / 2, Window.GetY() + Window.GetHeight() * 0.93, 2);
}
Plymouth.SetMessageFunction(display_message_callback);