-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFRUITPOP.PAS
119 lines (92 loc) · 2.3 KB
/
FRUITPOP.PAS
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
{$A+,B-,E+,F-,G+,I-,N+,P-,Q-,R-,S-,T-,V-,X+}
program FruitPopper;
uses GDGfx, GDKeybrd, GDTimer, GDEvents, FixedP, Math, MathFP, Toolbox,
Assets, Entities, Maps, Draw, Shared,
MainMenu, LevelSel, FruitSel, Match, Results, Help;
procedure FatalExit(message : string);
begin
CloseEvents;
CloseTimer;
CloseKeyboard;
CloseGraphics;
WriteLn('Fatal error. Exiting.');
if length(message) > 0 then
WriteLn('Cause: ', message);
Halt(1);
end;
procedure LoadEverything;
var
s : string[32];
begin
UseLayer(SCREEN_LAYER);
s := 'Loading 1/4 ...';
Cls(0);
DrawString(100, 96, 15, s);
if LoadFont('dp.fnt', @fnt) <> FontOk then
FatalExit('Failed loading font dp.fnt');
s := 'Loading 2/4 ...';
Cls(0);
DrawString(100, 96, 15, s);
if LoadFont('chunky.fnt', @chunkyFnt) <> FontOk then
FatalExit('Failed loading font chunky.fnt');
s := 'Loading 3/4 ...';
Cls(0);
DrawString(100, 96, 15, s);
if (not LoadTilesAndSprites('tiles.lbm')) then
FatalExit('Failed loading graphics tiles.lbm');
s := 'Loading 4/4 ...';
Cls(0);
DrawString(100, 96, 15, s);
if (not LoadImages('images.lbm')) then
FatalExit('Failed loading images images.lbm');
FadeOut;
Cls(0);
SetPalette(@pal);
end;
procedure DoIntro;
begin
UseLayer(SCREEN_LAYER);
UseFont(@fnt);
Cls(0);
BlackOutPalette;
WaitForTime(500);
DrawString(50, 96, 15, '... a GDR 4x4x4 Challenge Entry ...');
FadeIn;
WaitForTime(2000);
FadeOut;
WaitForTime(500);
Cls(0);
DrawString(50, 96, 15, '... created despite much slacking ...');
FadeIn;
WaitForTime(2000);
FadeOut;
WaitForTime(500);
Cls(0);
end;
begin
Randomize;
InitGraphics(2);
InitKeyboard;
InitTimer(TIMER_FREQ);
InitTrigTablesFP;
LoadEverything;
DoIntro;
currentGameState := StateMainMenu;
while currentGameState <> StateQuit do begin
case currentGameState of
StateMainMenu: DoMainMenu;
StateLevelSelect: DoLevelSelect;
StateFruitSelect: DoFruitSelect;
StateHelp: DoHelp;
StateMatch: begin
StartMatch;
MainLoop;
end;
StateResults: DoResults;
end;
end;
CloseEvents;
CloseTimer;
CloseKeyboard;
CloseGraphics;
end.