-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
945 lines (776 loc) · 19.8 KB
/
main.c
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
/***********************************************************************************
_ _
_ __ ___ _ __| |_ _ __(_)___
| '_ \ / _ \| '__| __| '__| / __|
| |_) | (_) | | | |_| | | \__ \
| .__/ \___/|_| \__|_| |_|___/
|_|
a portable Tetris implementation targetted on cc65 (https://cc65.github.io/cc65/)
(w)2002-2020 Groepaz/Solution ([email protected])
***********************************************************************************/
//#define DEBUG
// required libs
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>
#include <joystick.h>
// define screensize and some other capabilities of the target
#include "portris.h"
const char *VERSION = "0.5";
// include other headers
#include "input.h"
#include "output.h"
#include "title.h"
#if !defined(NOHISCORES)
#include "hiscore.h"
#endif
#include "effects.h"
typedef struct
{
// playfield position on screen
unsigned char px;
// position,rotation,color of current block
unsigned char bx,by;
unsigned char br,bc,bn;
// next block color,number
unsigned char nc,nn;
unsigned char gameover; // game over flag
unsigned char key; // last input "key"
unsigned char lastkey;
clock_t lasttick; // used for syncing
clock_t delayticks; // used for syncing
unsigned char lines,stage;
unsigned short score;
// playfield grid data
#if !defined(NO2DIMARRAYS)
unsigned char blk [PF_VY][PF_VX];
#else
unsigned char blk [PF_VY * PF_VX];
#endif
} PLAYFIELD;
PLAYFIELD pf[MAX_PLR];
#define NO_BLOCK 0xff
typedef struct
{
unsigned char size;
#if !defined(NO2DIMARRAYS)
unsigned char map [4][4 * 4];
#else
unsigned char map [4 * 4 * 4];
#endif
} BLOCK;
#define MAX_BLOCKS 4
// blocks data
#include "blocks.c"
// we don't need the table if no colors available
#if !(defined(NOCOLORS) && defined(NOBGCOLORS))
const unsigned char colortable[0x10]=
{
COLOR_BROWN,
COLOR_RED,
COLOR_ORANGE,
COLOR_GRAY2,
COLOR_LIGHTRED,
COLOR_GRAY3,
COLOR_YELLOW,
COLOR_WHITE,
COLOR_WHITE,
COLOR_LIGHTGREEN,
COLOR_CYAN,
COLOR_GREEN,
COLOR_LIGHTBLUE,
COLOR_VIOLET,
COLOR_GRAY1,
COLOR_BLUE,
};
#endif
// prototypes...
void init_pf(unsigned char n);
/***********************************************************************************
ticks root counter
this should be driven by some (more accurate?) generic timer api!
***********************************************************************************/
static clock_t ticks;
void ticks_reset(void)
{
ticks = 0;
}
void ticks_do(void)
{
// add elapsed time from timer api here
#ifdef NOCLOCK
ticks += 300;
#else
static clock_t clk, lclk, clocks;
clk = clock();
clocks = clk - lclk;
lclk = clk;
ticks += (1 + ((clocks * 256) / (CLOCKS_PER_SEC / 50)));
#endif
}
clock_t ticks_get(void)
{
return(ticks);
}
/***********************************************************************************
Playfield Subroutines
***********************************************************************************/
void block_set(PLAYFIELD *pf, register unsigned char col)
{
const BLOCK *blk;
register unsigned char *blocks;
register unsigned char *block;
unsigned char x, y, size;
unsigned char bx, by;
blk = GET1DIM(myblocks, pf->bn);
size = blk->size;
block = (unsigned char*)&GET2DIM(blk->map, pf->br, 0, 16);
bx = pf->bx + 3;
by = pf->by;
blocks = &GET2DIM(pf->blk, by, bx, PF_VX);
for(y = 0; y < size; ++y) {
for(x = 0; x < size; ++x) {
if(*block) {
*blocks = col;
}
++block;
++blocks;
}
blocks += (PF_VX - size);
}
}
void block_unset(PLAYFIELD *pf)
{
const BLOCK *blk;
register unsigned char *blocks;
register unsigned char *block;
unsigned char x, y, size;
unsigned char bx, by;
blk = GET1DIM(myblocks, pf->bn);
size = blk->size;
block = (unsigned char*)&GET2DIM(blk->map, pf->br, 0, 16);
bx = pf->bx + 3;
by = pf->by;
blocks = &GET2DIM(pf->blk, by, bx, PF_VX);
for(y = 0; y < size; ++y) {
for(x = 0; x < size; ++x) {
if(*block) {
*blocks = NO_BLOCK;
}
++block;
++blocks;
}
blocks += (PF_VX - size);
}
}
// check if block hits any other blocks
unsigned char block_checkhit_x(PLAYFIELD *pf, unsigned char ox)
{
const BLOCK *blk;
unsigned char *blocks;
unsigned char *block;
unsigned char x, y, bx, by, size;
blk = GET1DIM(myblocks, pf->bn);
size = blk->size;
block = (unsigned char*)&GET2DIM(blk->map, pf->br, 0, 16);
bx = pf->bx + ox;
by = pf->by;
blocks = &GET2DIM(pf->blk, by, bx, PF_VX);
for(y = 0; y < size; ++y) {
for(x = 0; x < size; ++x) {
if(*block++) {
if(*blocks != NO_BLOCK) {
return 1;
}
}
++blocks;
}
blocks += (PF_VX - size);
}
return 0;
}
unsigned char block_checkhit_y(PLAYFIELD *pf, unsigned char oy)
{
const BLOCK *blk;
unsigned char *blocks;
unsigned char *block;
unsigned char x, y, bx, by, size;
blk = GET1DIM(myblocks, pf->bn);
size = blk->size;
block = (unsigned char*)&GET2DIM(blk->map, pf->br, 0, 16);
bx = pf->bx + 3;
by = pf->by + oy;
blocks = &GET2DIM(pf->blk, by, bx, PF_VX);
for(y = 0; y < size; ++y) {
for(x = 0; x < size; ++x) {
if(*block++) {
if(*blocks != NO_BLOCK) {
return 1;
}
}
++blocks;
}
blocks += (PF_VX - size);
}
return 0;
}
// print next block
unsigned char block_printnext(PLAYFIELD *pf)
{
#ifdef __SDCC__
BLOCK *blk;
#else
const BLOCK *blk;
#endif
register unsigned char *block;
unsigned char x, y, bx, by, size;
#if !defined(NOCOLORS)
unsigned char col;
col = GET1DIM(colortable, pf->nc);
#endif
blk = GET1DIM(myblocks, pf->nn);
size = blk->size;
block = (unsigned char*)&GET2DIM(blk->map, 0, 0, 16);
bx = pf->px;
by = PF_Y + 1;
for(y = 0; y < 2; ++y) {
gotoxy(bx, by);
for(x = 0; x < size; ++x) {
if (*block) {
textcolor(col);
revers(1); cputc(BLK_SET); revers(0);
} else {
cputc(BLK_NONE);
}
++block;
}
while(x < 4) {
cputc(BLK_NONE);
++x;
}
++by;
}
return(0);
}
// set active block to next block
void block_next(PLAYFIELD *pf)
{
pf->bn = pf->nn; // block number
pf->bc = pf->nc; // color
// position new block
pf->bx = (PF_X / 2);
pf->by = 0;
}
// randomize next block
void block_randomize(PLAYFIELD *pf)
{
unsigned char c;
c = rand();
pf->nn = c & 0x3; // block number
pf->nc = c & 0xf; // color
}
// clears playfield and counts free blocks
int clear_pf(PLAYFIELD *pf)
{
unsigned char x, y;
register unsigned char *blocks;
unsigned char cnt = 0;
blocks = &GET2DIM(pf->blk, 0, 0, PF_VX);
for(y = 0; y < PF_Y + 3; ++y) {
for(x = 0; x < 3; ++x) {
*blocks++ =1;
}
for(x = 0; x < PF_X; ++x) {
if(*blocks == NO_BLOCK) {
cnt++;
} else {
*blocks = NO_BLOCK;
}
++blocks;
}
for(x = 0; x < 3; ++x) {
*blocks++ = 1;
}
}
for(; y < PF_VY; ++y) {
for(x = 0; x < PF_VX; ++x) {
*blocks++ = 1;
}
}
pf->lines = 0;
return(cnt);
}
// collapse playfield (remove full lines)
int collapse_pf(PLAYFIELD *pf)
{
unsigned char x, y;
unsigned char *blocks;
unsigned char cnt = 0,lines = 0;
blocks = &GET2DIM(pf->blk, (PF_Y + 2), (PF_X + 2), PF_VX);
for(y = (PF_Y + 2); y > 1;) {
cnt = 0;
for(x = 0; x < PF_X; ++x) {
if(*blocks != NO_BLOCK) {
++cnt;
}
--blocks;
}
if(cnt == 0) {
return(lines);
}
if(cnt == PF_X) {
// remove line
memmove(&GET2DIM(pf->blk, 1, 0, PF_VX),
&GET2DIM(pf->blk, 0, 0, PF_VX), y * PF_VX);
memset (&GET2DIM(pf->blk, 0, 0, PF_VX), 1, 3);
memset (&GET2DIM(pf->blk, 0, 3, PF_VX), NO_BLOCK, PF_X);
memset (&GET2DIM(pf->blk, 0, 3 + PF_X, PF_VX), 1, 3);
++lines;
// advance to next line
blocks -= 6;
--y;
} else {
// advance to next line
blocks -= 6;
--y;
}
}
pf->lines += lines;
return(lines);
}
// update one playfield
void update_pf_block(PLAYFIELD *pf)
{
unsigned char x, y, px, py, size;
register unsigned char blk;
register unsigned char *blocks;
if(pf->gameover) {
return;
}
size = GET1DIM(myblocks, pf->bn)->size;
py = pf->by;
if(!((size + py) > 3)) {
return;
} else {
if(py > 3) {
py--;
size++;
blocks = &GET2DIM(pf->blk, py, 3, PF_VX);
py-=3;
} else {
blocks = &GET2DIM(pf->blk, 3, 3, PF_VX);
py=0;
}
px = pf->px;
for(y = 0; (y < size) && (py < PF_Y); ++y) {
gotoxy(px,py);
for(x = 0; x < PF_X; ++x) {
blk = *blocks++;
if(blk == NO_BLOCK) {
cputc(BLK_NONE);
} else {
textcolor(GET1DIM(colortable,blk));
revers(1); cputc(BLK_SET); revers(0);
}
}
blocks += 6;
py++;
}
}
}
// update one playfield
void update_pf_all(PLAYFIELD *pf)
{
unsigned char x, y, px, py;
register unsigned char blk;
register unsigned char *blocks;
if(pf->gameover) {
return;
}
px = pf->px; py = 0;
blocks = &GET2DIM(pf->blk, 3, 3, PF_VX);
for(y = 0;y <PF_Y; ++y) {
gotoxy(px, py);
for(x = 0; x < PF_X; ++x) {
blk = *blocks++;
if(blk == NO_BLOCK) {
cputc(BLK_NONE);
} else {
textcolor(GET1DIM(colortable, blk));
revers(1); cputc(BLK_SET); revers(0);
}
}
blocks += 6;
py++;
}
}
void update_score(PLAYFIELD *pf,unsigned char score)
{
pf->score += score;
gotoxy(pf->px + 4, PF_Y + 1);
textcolor(COLOR_YELLOW);
cprintf("%05d", pf->score);
}
void update_stage(PLAYFIELD *pf, unsigned char stage)
{
pf->stage = stage;
if(stage < 16) {
pf->delayticks = 256 * (17 - stage);
} else {
pf->delayticks = 1;
}
gotoxy(pf->px + 7, PF_Y + 2);
textcolor(COLOR_YELLOW);
cprintf("%2d", stage);
if(stage > 1) {
// a stage gives 200 points, plus one
// point for each free block
update_score(pf, 200 + clear_pf(pf));
}
}
void update_lines(PLAYFIELD *pf, unsigned char lines)
{
pf->lines += lines;
gotoxy(pf->px + 4, PF_Y + 3);
textcolor(COLOR_YELLOW);
cprintf("%2d/%2d", LINES_PER_STAGE - pf->lines, LINES_PER_STAGE);
// each line gives 10 points, plus 1 for the block
update_score(pf, (10 * lines) + 1);
}
/***********************************************************************************
Ingame
***********************************************************************************/
void ingame_init(PLAYFIELD *pf)
{
#if defined (NOGLOBALPTRINIT)
myblocks[0] = &blk2_1;
myblocks[1] = &blk3_1;
myblocks[2] = &blk3_2;
myblocks[3] = &blk4_1;
#endif
clear_pf(pf);
// randomize two blocks in advance
block_randomize(pf);
block_next(pf);
block_randomize(pf);
block_printnext(pf);
// position new block
pf->bx = (PF_X / 2);
pf->by = 0;
pf->score = 0;
pf->stage = 0;
pf->lines = 0;
pf->gameover = 0;
update_pf_all(pf);
update_score(pf, 0);
update_stage(pf, 1);
update_lines(pf, 0);
}
void ingame_gameover(PLAYFIELD *pf)
{
textcolor(COLOR_WHITE);
cputsxy(pf->px + 2, 2, "game");
cputsxy(pf->px + 2, 4, "over");
cputsxy(pf->px + 2, 7, "press");
cputsxy(pf->px + 2, 9, "button");
pf->gameover = 1;
}
unsigned char dokeys(PLAYFIELD *pf)
{
if(pf->gameover) {
// start a new game
if(pf->key == TKEY_ROTATE) {
ingame_init(pf);
return(0);
}
} else {
switch(pf->key) {
// move left
case TKEY_LEFT:
if(!block_checkhit_x(pf, 3 - 1)) {
--pf->bx;
}
break;
// move right
case TKEY_RIGHT:
if(!block_checkhit_x(pf, 3 + 1)) {
++pf->bx;
}
break;
// rotate
case TKEY_ROTATE:
if (pf->lastkey != TKEY_ROTATE) {
pf->br = (pf->br + 1) & 3;
if(block_checkhit_x(pf, 3)) {
pf->br = (pf->br - 1) & 3;
}
}
break;
// drop
case TKEY_DROP:
if(!block_checkhit_y(pf, 1)) {
++pf->by;
}
break;
}
pf->lastkey = pf->key;
}
return(pf->key);
}
// move block down in constant speed according to current stage
void ingame_dropblock(PLAYFIELD *pf)
{
clock_t ticks;
// get current tick count
ticks = ticks_get();
if((ticks - pf->lasttick) > (pf->delayticks)) {
pf->lasttick = ticks;
if(!block_checkhit_y(pf, 1)) {
++pf->by;
}
}
}
// ingame loop for one player, returns
// 1 on game over, otherwhise 0
unsigned char ingame_doplr(PLAYFIELD *pf)
{
unsigned char lines;
if(pf->gameover) {
dokeys(pf);
if(pf->gameover) {
return(pf->gameover);
}
}
// remove block from playfield
block_unset(pf);
// move block position according to controller
if(dokeys(pf) != TKEY_DROP) {
// move block down in constant speed
ingame_dropblock(pf);
}
// clear keys
pf->key = 0;
// check if we did hit ground
if(block_checkhit_y(pf, 1)) {
// check if we are in visible area
if(pf->by < 2) {
// set game over
ingame_gameover(pf);
} else {
// put block on playfield
block_set(pf, pf->bc);
// remove complete lines
if((lines = collapse_pf(pf)) != 0) {
// each line gives 10 points, and each block 1 point
update_lines(pf, lines);
// check if stage completed
if(pf->lines >= LINES_PER_STAGE) {
update_stage(pf, pf->stage + 1);
}
// update complete playfield
update_pf_all(pf);
flashit(7);
} else {
// no lines removed
update_pf_block(pf);
// each block 1 point
update_score(pf,1);
}
// this block=next block
block_next(pf);
// next block=random
block_randomize(pf);
block_printnext(pf);
}
} else {
// we didnt hit ground
// put block on playfield
block_set(pf, pf->bc);
// update part of playfield with block
update_pf_block(pf);
}
return(pf->gameover);
}
void ingame(void)
{
unsigned char playing = 0;
unsigned char plr = 0;
unsigned char i;
// enable keyboard repeat mode with smallest delay and fastest repeatrate
kbrepeat(KBREPEAT_ALL);
// ingame init
clrscr();
for(i = 0; i < MAX_PLR; ++i) {
// position for the playfields on screen
// each playfield is PF_X*PF_Y characters large on screen
GET1DIM(pf, i).px = ((SCREENX - (MAX_PLR * (PF_X + 1))) / 2) + (i * (PF_X + 1));
init_pf(i);
}
while(!playing) {
poll_controller();
plr = 0;
for(i = 0; i < MAX_PLR; ++i) {
plr += ingame_doplr(&GET1DIM(pf, i));
}
if(plr != MAX_PLR) {
playing = 1;
}
ticks_do();
waitvsync();
flasher();
conio_update();
}
while(playing) {
poll_controller();
plr = 0;
for(i = 0; i < MAX_PLR; ++i) {
plr += ingame_doplr(&GET1DIM(pf, i));
}
if(plr == MAX_PLR) {
playing = 0;
}
ticks_do();
waitvsync();
flasher();
conio_update();
}
kbrepeat(KBREPEAT_ALL);
domeltdown();
#if !defined(NOHISCORES)
showhiscores();
#endif
}
void init_pf(unsigned char n)
{
PLAYFIELD *p;
p = &GET1DIM(pf, n);
ingame_init(p);
textcolor(COLOR_WHITE);
gotoxy(p->px, PF_Y);
chline(PF_X);
#ifdef CONIOSCROLLS
if((p->px + PF_X) == (SCREENX - 1)) {
gotoxy(p->px + PF_X, 0); cvline(SCREENY - 1);
} else {
#endif
gotoxy(p->px + PF_X, 0); cvline(SCREENY);
#ifdef CONIOSCROLLS
}
#endif
if((n + 1) == MAX_PLR) {
cputcxy(p->px + PF_X, PF_Y, CH_RTEE);
} else {
cputcxy(p->px + PF_X, PF_Y, CH_CROSS);
}
// draw line at left side of first playfield
// if odd screensize allows this
if((n == 0) && (p->px > 0)) {
cvlinexy(p->px - 1, 0, SCREENY);
cputcxy(p->px - 1, PF_Y, CH_LTEE);
}
cputsxy(p->px, PF_Y + 1 + 2, "next");
cputsxy(p->px + 4, PF_Y + 2, "lvl");
ingame_gameover(p);
}
/***********************************************************************************
Main Loop
***********************************************************************************/
#ifdef __SDL__
int main(int argc, char *argv[])
#else
int main(void)
#endif
{
unsigned char finished = 0;
#if defined (__C128__)
unsigned char oldvideomode;
#if defined (__VDC__)
oldvideomode = videomode(VIDEOMODE_80COL);
#else
oldvideomode = videomode(VIDEOMODE_40COL);
#endif
#endif
#if defined(GFXCONIOINIT)
gfx_conio_init();
#endif
#if defined(__GAMECUBE__)
VIInit();
PADInit();
#endif
#if defined(CONIOINIT)
conio_init();
#endif
#if defined(__GAMECUBE__) | defined(__PSP__)
conio_foreground();
conio_disable_backscroll();
#endif
// make the screen all black (huu :=P)
bgcolor(COL_BG); bordercolor(COL_BG); textcolor(COL_BG);clrscr();
// select driver + init joystick api
init_joy();
#if !defined(NOHISCORES)
inithiscore();
#endif
// reset timers
ticks_reset();
#if defined(NOTITLESCREEN)
// simpler main loop when there is no title screen
while (1) {
ingame();
#if !defined(NOHISCORES)
showhiscores();
#endif
}
#else
// enter the main loop
while(!finished) {
// the title screen
switch(title()) {
case 'q':
// quit
finished=1;
break;
#if !defined(NOHISCORES)
case 'h':
// display the hiscores
showhiscores();
break;
#endif
case 'c':
// configure controller
init_joy();
break;
case ' ':
// do ingame
ingame();
break;
}
}
#endif
#ifndef CONIORESTORES
clrscr();
#endif
// restore original video mode
#if defined (__C128__)
cputs("switching to old video mode...\n\r");
videomode(oldvideomode);
#endif
// KLUDGES: enter geos desktop
#if defined(__GEOS__)
//EnterDeskTop();
#endif
return (EXIT_SUCCESS);
}
#include "input.c"
#include "output.c"
#if !defined(NOTITLESCREEN)
#include "title.c"
#endif
#if !defined(NOHISCORES)
#include "hiscore.c"
#endif
#include "effects.c"