elias / BeforeEcbatana (public) (License: Public Domain) (since 2024-10-27) (hash sha1)
A game for TempleOS inspired by After Egypt and based on the Book of Tobit.
List of commits:
Subject Hash Author Date (UTC)
initial upload bdba08af37ec9a1d04864f57900670f6c7f88dce elias 2024-10-27 05:00:29
Commit bdba08af37ec9a1d04864f57900670f6c7f88dce - initial upload
Author: elias
Author date (UTC): 2024-10-27 05:00
Committer name: elias
Committer date (UTC): 2024-10-27 05:00
Parent(s):
Signer:
Signing key:
Signing status: N
Tree: 1c8d9629b82d8ffd71095a881777368670769227
File Lines added Lines deleted
BESplash.HC 355 0
BeforeEcbatana.HC 331 0
Splash.BMP 0 0
File BESplash.HC added (mode: 100644) (index 0000000..8024377)
1 #define BMP_COLORS_NUM 16
2
3 class CFileBMP {
4 U16 type;
5 U32 file_size;
6 U32 reserved;
7 U32 data_offset;
8
9 U32 header_size;
10 U32 width;
11 U32 height;
12 U16 planes;
13 U16 bit_cnt;
14 U32 compression;
15 U32 image_size;
16 U32 x_pixs_per_meter;
17 U32 y_pixs_per_meter;
18 U32 colors_used;
19 U32 important_colors;
20
21 U0 end;
22
23 CBGR24 palette[BMP_COLORS_NUM];
24 };
25
26 public
27 CFileBMP *BMP4To(CDC *dc) {
28 U8 *src, *ptr;
29 CBGR48 palette[COLORS_NUM];
30 I64 i, x, y, w = dc->width >> 1,
31 size = sizeof(CFileBMP) + dc->width * dc->height >> 1;
32 CFileBMP *bmp = CAlloc(size);
33 bmp->type = 'BM';
34 bmp->planes = 1;
35 bmp->file_size = size;
36 bmp->data_offset = sizeof(CFileBMP);
37 bmp->header_size = offset(CFileBMP.end) - offset(CFileBMP.header_size);
38 bmp->width = dc->width;
39 bmp->height = dc->height;
40 bmp->bit_cnt = 4;
41 bmp->image_size = dc->width * dc->height >> 1;
42 GrPaletteGet(palette);
43 #assert COLORS_NUM == BMP_COLORS_NUM
44 for (i = 0; i < BMP_COLORS_NUM; i++) {
45 bmp->palette[i].b = palette[i].b >> 8;
46 bmp->palette[i].g = palette[i].g >> 8;
47 bmp->palette[i].r = palette[i].r >> 8;
48 bmp->palette[i].pad = 0;
49 }
50 ptr = bmp(U8 *) + bmp->data_offset;
51 for (y = dc->height - 1; y >= 0; y--) {
52 src = y * dc->width_internal + dc->body;
53 for (x = 0; x < w; x++) {
54 *ptr |= (*src++ & 15) << 4;
55 *ptr |= *src++ & 15;
56 ptr++;
57 }
58 }
59 return bmp;
60 }
61
62 public
63 CFileBMP *BMPRLE4To(CDC *dc) {
64 U8 *src, *ptr, *start;
65 I64 i, x, y, w = dc->width, cnt, pattern;
66 CBGR48 palette[COLORS_NUM];
67 CFileBMP *bmp = CAlloc(sizeof(CFileBMP) + 2 * (dc->width + 1) * dc->height);
68 bmp->type = 'BM';
69 bmp->planes = 1;
70 bmp->data_offset = sizeof(CFileBMP);
71 bmp->header_size = offset(CFileBMP.end) - offset(CFileBMP.header_size);
72 bmp->width = dc->width;
73 bmp->height = dc->height;
74 bmp->bit_cnt = 4;
75 bmp->compression = 2;
76 GrPaletteGet(palette);
77 #assert COLORS_NUM == BMP_COLORS_NUM
78 for (i = 0; i < BMP_COLORS_NUM; i++) {
79 bmp->palette[i].b = palette[i].b >> 8;
80 bmp->palette[i].g = palette[i].g >> 8;
81 bmp->palette[i].r = palette[i].r >> 8;
82 bmp->palette[i].pad = 0;
83 }
84 start = ptr = bmp(U8 *) + bmp->data_offset;
85 for (y = dc->height - 1; y >= 0; y--) {
86 src = y * dc->width_internal + dc->body;
87 x = 0;
88 while (x < w) {
89 pattern = (src[0] & 15) << 4 + src[1] & 15;
90 if (x + 1 < w && src[0] & 15 == src[1] & 15) {
91 src += 2;
92 cnt = 2;
93 x += 2;
94 while (x < w && cnt < U8_MAX) {
95 if (*src & 15 == pattern & 15) {
96 src++;
97 cnt++;
98 x++;
99 } else
100 break;
101 }
102 } else {
103 src += 2;
104 if (x + 1 < w)
105 cnt = 2;
106 else
107 cnt = 1;
108 x += 2;
109 }
110 *ptr++ = cnt;
111 *ptr++ = pattern;
112 }
113 *ptr(U16 *)++ = 0;
114 }
115 bmp->image_size = ptr - start;
116 bmp->file_size = sizeof(CFileBMP) + bmp->image_size;
117 return bmp;
118 }
119
120 public
121 CFileBMP *BMP24To(CDC *dc) {
122 U8 *src;
123 I64 i, x, y,
124 size = offset(CFileBMP.end) + dc->width * dc->height * sizeof(CBGR24);
125 CBGR24 *bgr;
126 CFileBMP *bmp = CAlloc(size);
127 bmp->type = 'BM';
128 bmp->planes = 1;
129 bmp->file_size = size;
130 bmp->data_offset = offset(CFileBMP.end);
131 bmp->header_size = offset(CFileBMP.end) - offset(CFileBMP.header_size);
132 bmp->width = dc->width;
133 bmp->height = dc->height;
134 bmp->bit_cnt = 32;
135 bmp->image_size = dc->width * dc->height << 2;
136
137 bgr = bmp(U8 *) + bmp->data_offset;
138 for (y = dc->height - 1; y >= 0; y--) {
139 src = y * dc->width_internal + dc->body;
140 for (x = 0; x < dc->width; x++) {
141 i = *src++;
142 if (i & BLUE)
143 bgr->b = 0x7F;
144 if (i & GREEN)
145 bgr->g = 0x7F;
146 if (i & RED)
147 bgr->r = 0x7F;
148 if (i & 8) {
149 if (bgr->b)
150 bgr->b = 0xFF;
151 if (bgr->g)
152 bgr->g = 0xFF;
153 if (bgr->r)
154 bgr->r = 0xFF;
155 }
156 bgr(U8 *) += 4;
157 }
158 }
159 return bmp;
160 }
161
162 public
163 I64 BMPWrite(U8 *filename, CDC *dc, I64 bits = 4) {
164 I64 size;
165 CFileBMP *bmp;
166 if (bits == 4) {
167 if (IsDotZ(filename))
168 bmp = BMP4To(dc);
169 else {
170 bmp = BMPRLE4To(dc);
171 if (bmp->file_size > sizeof(CFileBMP) + dc->width * dc->height >> 1) {
172 Free(bmp);
173 bmp = BMP4To(dc);
174 }
175 }
176 } else if (bits == 24)
177 bmp = BMP24To(dc);
178 else {
179 "Format Not Supported.\n";
180 return 0;
181 }
182 size = bmp->file_size;
183 FileWrite(filename, bmp, bmp->file_size);
184 Free(bmp);
185 return size;
186 }
187
188 U8 *BMPPaletteNew(CFileBMP *bmp) {
189 I64 i, j, best, score, best_score;
190 CBGR48 palette[COLORS_NUM];
191 U8 *res = CAlloc(BMP_COLORS_NUM * sizeof(U8));
192 GrPaletteGet(palette);
193 #assert COLORS_NUM == BMP_COLORS_NUM
194 for (i = 0; i < BMP_COLORS_NUM; i++) {
195 best = i;
196 best_score = I64_MAX;
197 for (j = 0; j < BMP_COLORS_NUM; j++) {
198 score = SqrI64(bmp->palette[i].r - palette[j].r >> 8) +
199 SqrI64(bmp->palette[i].g - palette[j].g >> 8) +
200 SqrI64(bmp->palette[i].b - palette[j].b >> 8);
201 if (score < best_score) {
202 best = j;
203 best_score = score;
204 }
205 }
206 res[i] = best;
207 }
208 return res;
209 }
210
211 U8 ms_paint_palette[BMP_COLORS_NUM] = {0, 4, 2, 6, 1, 5, 3, 8,
212 7, 12, 10, 14, 9, 13, 11, 15};
213
214 I64 BMP24Color(CBGR24 *ptr, Bool dither_probability) {
215 I64 res, k;
216 if (dither_probability) {
217 k = RandU32;
218 if (SqrI64(ptr->r) + SqrI64(ptr->g) + SqrI64(ptr->b) >= 3 * SqrI64(k.u8[0]))
219 res = 8;
220 else
221 res = 0;
222 if (ptr->r >= k.u8[1])
223 res |= RED;
224 if (ptr->g >= k.u8[2])
225 res |= GREEN;
226 if (ptr->b >= k.u8[3])
227 res |= BLUE;
228 } else {
229 if (SqrI64(ptr->r) + SqrI64(ptr->g) + SqrI64(ptr->b) >= SqrI64(0x80)) {
230 res = WHITE;
231 if (ptr->r >= 0x80)
232 res |= RED;
233 if (ptr->g >= 0x80)
234 res |= GREEN;
235 if (ptr->b >= 0x80)
236 res |= BLUE;
237 } else {
238 res = BLACK;
239 if (ptr->r >= 0x40)
240 res |= RED;
241 if (ptr->g >= 0x40)
242 res |= GREEN;
243 if (ptr->b >= 0x40)
244 res |= BLUE;
245 }
246 }
247 return res;
248 }
249
250 public
251 CDC *BMPRead(U8 *filename, Bool dither_probability = FALSE,
252 Bool use_ms_paint_palette = FALSE) {
253 I64 i, j, cnt;
254 U8 *palette_map, *ptr;
255 Bool rle;
256 CFileBMP *bmp;
257 CDC *res = NULL;
258 if (ptr = FileRead(filename)) {
259 bmp = ptr;
260 if (0 < bmp->width < I32_MAX && 0 < bmp->height < I32_MAX) {
261 res = DCNew(bmp->width, bmp->height);
262 ptr += bmp->data_offset;
263 if (bmp->compression == 2)
264 rle = TRUE;
265 else
266 rle = FALSE;
267 if (use_ms_paint_palette)
268 palette_map = ms_paint_palette;
269 else
270 palette_map = BMPPaletteNew(bmp);
271 if (bmp->bit_cnt == 4) {
272 for (i = bmp->height - 1; i >= 0; i--)
273 if (rle) {
274 j = 0;
275 while (cnt = *ptr++) {
276 if (cnt == 1) {
277 res->color = palette_map[*ptr++ & 15];
278 GrPlot(res, j++, i);
279 } else {
280 if (cnt == 2 && *ptr >> 4 != *ptr & 15) {
281 res->color = palette_map[*ptr & 15];
282 GrPlot(res, j + 1, i);
283 res->color = palette_map[*ptr >> 4];
284 GrPlot(res, j, i);
285 ptr++;
286 j += 2;
287 } else {
288 res->color = palette_map[*ptr++ & 15];
289 while (cnt--)
290 GrPlot(res, j++, i);
291 }
292 }
293 }
294 ptr++;
295 } else
296 for (j = 0; j < (bmp->width + 7) & ~7;) {
297 res->color = palette_map[*ptr & 15];
298 GrPlot(res, j + 1, i);
299 res->color = palette_map[*ptr >> 4];
300 GrPlot(res, j, i);
301 ptr++;
302 j += 2;
303 }
304 if (!use_ms_paint_palette)
305 Free(palette_map);
306 } else if (bmp->bit_cnt == 24) {
307 for (i = bmp->height - 1; i >= 0; i--) {
308 for (j = 0; j < bmp->width; j++, ptr += 3) {
309 res->color = BMP24Color(ptr, dither_probability);
310 GrPlot(res, j, i);
311 }
312 ptr += bmp->width & 3;
313 }
314 if (!use_ms_paint_palette)
315 Free(palette_map);
316 } else if (bmp->bit_cnt >= 32) {
317 for (i = bmp->height - 1; i >= 0; i--)
318 for (j = 0; j < bmp->width; j++, ptr += 4) {
319 res->color = BMP24Color(ptr, dither_probability);
320 GrPlot(res, j, i);
321 }
322 if (!use_ms_paint_palette)
323 Free(palette_map);
324 } else {
325 "Format Not Supported.\n";
326 DCDel(res);
327 res = NULL;
328 }
329 } else
330 "Invalid BMP File\n";
331 Free(bmp);
332 }
333 return res;
334 }
335
336 U0 BESplash() {
337 CDC *dc = DCAlias;
338 CDC *bmp_dc;
339
340 WinMax;
341 DocClear;
342
343 if (bmp_dc = BMPRead("T:/BeforeEcbatana/Splash.BMP", TRUE, FALSE)) {
344 GrBlot(dc, (GR_WIDTH - bmp_dc->width) / 2, (GR_HEIGHT - bmp_dc->height) / 2,
345 bmp_dc);
346 DCDel(bmp_dc);
347 } else {
348 dc->color = YELLOW;
349 GrPrint(dc, GR_WIDTH / 2 - 100, 50, "BeforeEcbatana");
350 }
351
352 DCDel(dc);
353 }
354
355 BESplash;
File BeforeEcbatana.HC added (mode: 100644) (index 0000000..6f3ccca)
1 I64 num_companions = 2;
2
3 U0 SongTask(I64) {
4 Fs->task_end_cb = &SndTaskEndCB;
5 MusicSettingsRst;
6 while (TRUE) {
7 Play("4eABqC5D4etA5DC4B5CqC4etBAG");
8 Play("4eABqC5D4etA5DC4B5CqC4etBAG");
9 Play("4qG5etC4GGqA5C4eA5DqDetDCF4A5F");
10 Play("4qG5etC4GGqA5C4eA5DqDetDCF4A5F");
11 }
12 }
13
14 U0 Travel() {
15 I64 event;
16 Bool old_form = LBts(&(DocPut)->flags, DOCf_FORM);
17
18 DocDblBufStart;
19 event = RandU32 % 6;
20 "%s", LstSub(event, "You encounter wandering Zoroastrian priests.\0"
21 "You reach the great city of Ecbatana, home of Raguel.\0"
22 "Night approaches as you travel near Mount Ararat.\0"
23 "You make camp by the Tigris River.\0"
24 "You meet fellow Israelites heading home to Nineveh.\0"
25 "The road winds through the mountains of Media.\0");
26
27 "\n\n\n\n"
28 "$$LM,4$$"
29 "\n\n$$BT,\"Talk to God\",LE=0$$\n\n"
30 "\n\n$$BT,\"Rest and Pray\",LE=1$$\n\n"
31 "\n\n$$BT,\"Proclaim God's Glory\",LE=2$$\n\n"
32 "\n\n$$BT,\"Eat Fish\",LE=2$$\n\n"
33 "$$LM,0$$";
34 DocDblBufEnd;
35 DocMenu(DocPut);
36
37 LBEqu(&(DocPut)->flags, DOCf_FORM, old_form);
38 DocBottom;
39 }
40
41 U0 Raphael() {
42 I64 dialogue;
43 Bool old_form = LBts(&(DocPut)->flags, DOCf_FORM);
44
45 DocDblBufStart;
46 dialogue = RandU32 % 6;
47 "%s", LstSub(
48 dialogue,
49 "\"I am Azarias, son of the great Ananias, of your people.\"\0"
50 "\"The fish's heart and liver will drive away demons.\"\0"
51 "\"Be strong and take courage - God has heard your prayers.\"\0"
52 "\"In Media dwells Raguel, your kinsman with a daughter, Sarah.\"\0"
53 "\"Give thanks to the Lord, for He is good.\"\0"
54 "\"Your father's alms and prayers have come before God.\"\0");
55
56 "\n\n\n\n"
57 "$$LM,4$$"
58 "\n\n$$BT,\"Ask for Guidance\",LE=0$$\n\n"
59 "\n\n$$BT,\"Give Thanks\",LE=1$$\n\n"
60 "\n\n$$BT,\"Continue Journey\",LE=2$$\n\n"
61 "$$LM,0$$";
62 DocDblBufEnd;
63 DocMenu(DocPut);
64
65 LBEqu(&(DocPut)->flags, DOCf_FORM, old_form);
66 DocBottom;
67 }
68
69 U0 Tigris() {
70 I64 event;
71 Bool old_form = LBts(&(DocPut)->flags, DOCf_FORM);
72
73 DocDblBufStart;
74 event = RandU32 % 5;
75 "%s", LstSub(event,
76 "\"Take out its heart, liver and gall,\" instructs Raphael.\0"
77 "The fish thrashes as you pull it onto the shore.\0"
78 "A great fish attempts to swallow your foot! \"Catch it!\" "
79 "cries Raphael.\0"
80 "You carefully preserve the fish's organs as instructed.\0");
81
82 "\n\n\n\n"
83 "$$LM,4$$"
84 "\n\n$$BT,\"Catch Fish\",LE=0$$\n\n"
85 "\n\n$$BT,\"Extract Organs\",LE=1$$\n\n"
86 "\n\n$$BT,\"Preserve with Salt\",LE=2$$\n\n"
87 "$$LM,0$$";
88 DocDblBufEnd;
89 DocMenu(DocPut);
90
91 LBEqu(&(DocPut)->flags, DOCf_FORM, old_form);
92 DocBottom;
93 }
94
95 U0 Wedding() {
96 I64 event;
97 Bool old_form = LBts(&(DocPut)->flags, DOCf_FORM);
98
99 DocDblBufStart;
100 event = RandU32 % 5;
101 "%s",
102 LstSub(
103 event,
104 "Raguel blesses the union: \"Take her according to the law of "
105 "Moses.\"\0"
106 "Sarah prays: \"Have mercy on us, O Lord, have mercy.\"\0"
107 "\"Blessed are you, O God of our fathers,\" you pray together.\0"
108 "You prepare the fish's heart and liver as Raphael instructed.\0"
109 "\"May the God of heaven prosper you, my children,\" says Raguel.\0");
110
111 "\n\n\n\n"
112 "$$LM,5$$"
113 "\n\n$$BT,\"Burn Heart and Liver\",LE=0$$\n\n"
114 "\n\n$$BT,\"Pray Together\",LE=1$$\n\n"
115 "\n\n$$BT,\"Sign Contract\",LE=2$$\n\n"
116 "\n\n$$BT,\"Consummate Marriage\",LE=3$$\n\n"
117
118 "$$LM,0$$";
119 DocDblBufEnd;
120 DocMenu(DocPut);
121
122 LBEqu(&(DocPut)->flags, DOCf_FORM, old_form);
123 DocBottom;
124 }
125
126 U0 Healing() {
127 I64 event;
128 Bool old_form = LBts(&(DocPut)->flags, DOCf_FORM);
129
130 DocDblBufStart;
131 event = RandU32 % 5;
132 "%s", LstSub(event,
133 "\"Be brave, father,\" you say as you prepare the fish's gall.\0"
134 "You apply the gall to your father's clouded eyes.\0"
135 "\"Blessed be God!\" your father cries as his sight returns.\0");
136
137 "\n\n\n\n"
138 "$$LM,4$$"
139 "\n\n$$BT,\"Apply Gall\",LE=0$$\n\n"
140 "\n\n$$BT,\"Pray for Healing\",LE=1$$\n\n"
141 "\n\n$$BT,\"Give Thanks\",LE=2$$\n\n"
142 "\n\n$$BT,\"Comfort your Mother\",LE=2$$\n\n"
143 "$$LM,0$$";
144 DocDblBufEnd;
145 DocMenu(DocPut);
146
147 LBEqu(&(DocPut)->flags, DOCf_FORM, old_form);
148 DocBottom;
149 }
150
151 U0 SenseHeading() {
152 I64 location;
153 Bool old_form = LBts(&(DocPut)->flags, DOCf_FORM);
154
155 DocDblBufStart;
156 location = RandU32 % 4;
157 "%s", LstSub(location, "You study your route from Nineveh to Media.\0"
158 "The Tigris River stretches before you.\0"
159 "Ecbatana lies ahead, where Raguel dwells.\0"
160 "The road leads onward to Rages.\0");
161
162 "\n\n\n\n"
163 "$$LM,4$$"
164 "\n\n$$BT,\"Continue Journey\",LE=0$$\n\n"
165 "\n\n$$BT,\"Rest Here\",LE=1$$\n\n"
166 "\n\n$$BT,\"Ask Directions\",LE=2$$\n\n"
167 "$$LM,0$$";
168 DocDblBufEnd;
169 DocMenu(DocPut);
170
171 LBEqu(&(DocPut)->flags, DOCf_FORM, old_form);
172 DocBottom;
173 }
174
175 U0 Prayer() {
176 I64 prayer_type;
177 Bool old_form = LBts(&(DocPut)->flags, DOCf_FORM);
178
179 DocDblBufStart;
180 prayer_type = RandU32 % 5;
181 "%s", LstSub(prayer_type, "\"Blessed are you, O God of our fathers.\"\0"
182 "\"Your name is worthy of praise for all ages.\"\0"
183 "\"Let heaven and earth bless you forever.\"\0"
184 "\"Your mercy, O Lord, endures forever.\"\0"
185 "\"Blessed are you who have made me glad.\"\0");
186
187 "\n\n\n\n"
188 "$$LM,4$$"
189 "\n\n$$BT,\"Offer Incense\",LE=0$$\n\n"
190 "\n\n$$BT,\"Fast and Prostrate\",LE=1$$\n\n"
191 "\n\n$$BT,\"Give Alms\",LE=2$$\n\n"
192 "$$LM,0$$";
193 DocDblBufEnd;
194 DocMenu(DocPut);
195
196 LBEqu(&(DocPut)->flags, DOCf_FORM, old_form);
197 DocBottom;
198 }
199
200 #define T_REST 0
201 #define T_PRAY 1
202 #define T_JOURNEY 2
203 #define T_RAPHAEL 3
204 #define T_TIGRIS 4
205 #define T_WEDDING 5
206 #define T_HEALING 6
207 #define T_SENSE_HEADING 7
208 #define T_HELP 8
209 #define T_QUIT 9
210
211 Bool TakeTurn() {
212 I64 i;
213 Bool res, old_form = LBts(&(DocPut)->flags, DOCf_FORM);
214
215 if (!Fs->song_task)
216 Fs->song_task = Spawn(&SongTask, NULL, "Song", , Fs);
217
218 DocDblBufStart;
219 "$$LM,4$$"
220 "\n\n$$BT,\"Rest for the Night\",LE=T_REST$$\n\n"
221 "\n\n$$BT,\"Offer Prayers\",LE=T_PRAY$$\n\n"
222 "\n\n$$BT,\"Continue Journey\",LE=T_JOURNEY$$\n\n"
223 "\n\n$$BT,\"Speak to Raphael\",LE=T_RAPHAEL$$\n\n"
224 "\n\n$$BT,\"Wash Feet\",LE=T_TIGRIS$$\n\n"
225 "\n\n$$BT,\"Visit Raguel\",LE=T_WEDDING$$\n\n"
226 "\n\n$$BT,\"Cure Blindness\",LE=T_HEALING$$\n\n"
227 "\n\n$$BT,\"Sense Heading\",LE=T_SENSE_HEADING$$\n\n"
228 "\n\n$$BT,\"Help\",LE=T_HELP$$\n\n"
229 "\n\n$$BT,\"Quit\",LE=T_QUIT$$\n\n"
230 "$$LM,0$$";
231 DocDblBufEnd;
232 i = DocMenu(DocPut, DOF_DONT_TEXT_ATTR);
233
234 LBEqu(&(DocPut)->flags, DOCf_FORM, old_form);
235 DocBottom;
236
237 if (!(0 <= i < T_QUIT))
238 res = FALSE;
239 else {
240 switch (i) {
241 case T_REST:
242 PopUpOk("You pray for a dreamless sleep.\n");
243 GetChar;
244 break;
245 case T_PRAY:
246 Prayer;
247 break;
248 case T_JOURNEY:
249 Travel;
250 break;
251 case T_RAPHAEL:
252 Raphael;
253 break;
254 case T_TIGRIS:
255 Tigris;
256 break;
257 case T_WEDDING:
258 Wedding;
259 break;
260 case T_HEALING:
261 Healing;
262 break;
263 case T_SENSE_HEADING:
264 SenseHeading;
265 break;
266 case T_HELP:
267 PopUpOk("Trust in the Lord's guidance.\n"
268 "Remember your father, Tobit.\n"
269 "Keep faith through all trials.\n");
270 break;
271 }
272 res = TRUE;
273 }
274 Refresh;
275 Fs->song_task = NULL;
276 return res;
277 }
278
279 U0 TMsg(CDC *dc, U8 *msg, F64 duration = 1.5) {
280 F64 t0 = tS;
281 while (tS - t0 < duration) {
282 if (Blink(5))
283 dc->color = BLACK;
284 else
285 dc->color = RED;
286 GrRect(dc, 0, GR_HEIGHT - FONT_HEIGHT * 3, GR_WIDTH, FONT_HEIGHT * 2);
287 dc->color = BLACK;
288 GrRect(dc, 2, GR_HEIGHT - FONT_HEIGHT * 3 + 2, GR_WIDTH - 4,
289 FONT_HEIGHT * 2 - 4);
290 dc->color = YELLOW;
291 GrPrint(dc, (GR_WIDTH - StrLen(msg) * FONT_WIDTH) / 2,
292 GR_HEIGHT - 5 * FONT_HEIGHT / 2, "%s", msg);
293 Refresh;
294 if (ScanChar)
295 throw('Except');
296 }
297 }
298
299 U0 Intro() {
300 CDC *dc = DCAlias;
301 WinBorder;
302 WinMax;
303
304 try {
305 TMsg(dc, "A righteous man in troubled times...", 2.5);
306 TMsg(dc, "A journey guided by an angel...", 2.0);
307 TMsg(dc, "Faith, healing, and divine providence...", 2.0);
308 TMsg(dc, "\"Trust in the Lord!\"", 3.0);
309 } catch Fs->catch_except = TRUE;
310 DCFill;
311 DCDel(dc);
312 }
313
314 U0 Main() {
315 SettingsPush;
316 DocClear;
317 ExeFile("BESplash");
318 Sleep(1500);
319 Fs->song_task = Spawn(&SongTask, NULL, "Song", , Fs);
320 AutoComplete;
321 WinBorder;
322 WinMax;
323 DocClear;
324 PopUp("Intro;", Fs);
325 try while (TakeTurn);
326 catch PutExcept;
327 DocClear;
328 SettingsPop;
329 }
330
331 Main;
File Splash.BMP added (mode: 100644) (index 0000000..0cd5bb7)
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/elias/BeforeEcbatana

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/elias/BeforeEcbatana

Clone this repository using git:
git clone git://git.rocketgit.com/user/elias/BeforeEcbatana

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main