-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisplay.p
executable file
·241 lines (225 loc) · 6.1 KB
/
Display.p
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
unit Display;
interface
uses
Sound, QDOffScreen, Tools, Globals, GameGlobals, GameTools,
Resources, Icons;
procedure DoDisplay;
implementation
type
SC=array [0..70] of Point;
SP=^SC;
SH=^SP;
var
SpeedometerConsts:SC;
BlinckTick:longint;
procedure DoDisplay;
var
Speed: integer;
NumStr,ScoreString: Str255;
var
BonRect: Rect;
procedure Waitproc;
begin
if Wait <> 0 then
begin
Speedometerconsts:=SH(GetResource('Sped',1000))^^;
BlinckTick:=0;
if Wait > 38 then
begin
GetIndString(ScoreString, 2000, 6);
NumToString(Level, NumStr);
ShowMessage(ScoreString, 310 - 80, 200, 36);
ShowMessage(NumStr, 310 +43, 200, 36);
ShowMessage(Info^^.name, 310-Stringwidth(Info^^.name) div 2, 250, 36);
end
else if Wait > 1 then
begin
if (Wait+2) mod 10 =0 then
PlaySound(1100);
SetRect(BonRect, 620 - 38, 480 - 62, 620 - 6, 480 - 30);
if Wait > 8 then
PlotSprite(1021, BonRect)
else
PlotSprite(1022, BonRect);
end
else
begin
PlaySound(1101);
SetRect(BonRect, 620 - 38, 480 - 62, 620 - 6, 480 - 30);
PlotSprite(1023, BonRect)
end;
Wait := Wait - 1;
end;
end;
procedure GameOProc;
begin
if GameOver then
begin
GetIndString(ScoreString, 2000, 3);
ShowMessage(ScoreString, 310 - 100, 240, 36);
GameOCount := GameOCount + 1;
end;
end;
procedure DoneProc;
var timer:longint;
begin
if DoneCount <>0 then
begin
if DoneCount > 0 then
begin
GetIndString(ScoreString, 2000, 4);
ShowMessage(ScoreString, 310 - 120, 240, 36);
end;
if (DoneCount < 0) and (DoneCount > -10) then
begin
if DoneCount <= -1 then
begin
GetIndString(ScoreString, 2001, 1);
NumToString(Level, NumStr);
if NumStr[0]=char(2) then begin
ScoreString[7]:= NumStr[1];
ScoreString[8]:= NumStr[2];
end else
ScoreString[8]:= NumStr[1];
ShowMessage(ScoreString, 310 - 120, 240 - 100, 24);
if DoneCount = -1 then
PlaySound(1105);
delay(15, timer);
KillEngine;
end;
if DoneCount <= -4 then
begin
GetIndString(ScoreString, 2001, 3);
ShowMessage(ScoreString, 310 - 120, 240 - 60, 12);
NumToString(Score, ScoreString);
ShowMessage(ScoreString, 310 - 105, 240 - 40, 18);
if DoneCount = -4 then
PlaySound(1105);
delay(15, timer);
end;
if DoneCount <= -7 then
begin
GetIndString(ScoreString, 2001, 4);
ShowMessage(ScoreString, 310 - 120, 240 - 0, 12);
NumToString(Info^^.Bonus, ScoreString);
ShowMessage(ScoreString, 310 - 105, 240 + 20, 18);
if MultiBonus < 0 then
begin
SetRect(BonRect, 310 -40, 240 + 2, 310 - 16, 240 + 26);
PlotSprite(1030 + abs(multiBonus), BonRect);
AddUpRect(BonRect);
NumToString(Info^^.Bonus * (abs(MultiBonus)+1), ScoreString);
ShowMessage(ScoreString, 310 , 240 + 20, 18);
if DoneCount = -9 then
Info^^.Bonus := Info^^.Bonus * (abs(MultiBonus)+1);
end;
if DoneCount = -7 then
PlaySound(1105);
delay(15, timer);
end;
end;
if (DoneCount = -11) then
begin
GetIndString(ScoreString, 2001, 5);
ShowMessage(ScoreString, 310 - 80, 240 - 29, 24);
DoneCount := -10;
if Info^^.Bonus > 15 then
begin
Score := Score + 15;
Info^^.Bonus := Info^^.Bonus - 15;
end
else
begin
Score := Score + Info^^.Bonus;
Info^^.Bonus := 0;
DoneCount := -20;
end;
if BlinckTick+41<TickCount then
PlaySound(1106);
NumToString(Score,Numstr);
ShowMessage(NumStr, 310 - 50, 240 +21, 36);
end;
if DoneCount = -20 then
begin
DisposeLevel;
Level := Level + 1;
EnterLevel(Level);
end;
end;
end;
procedure DispProc;
var
oldclip,Newclip:rgnHandle;
myIcon:CIconHandle;
begin
SetRect(BonRect, 17, 480 - 86, 81, 480 - 22);
if not Dead then
begin
Speed := (UDSpeed -abs(LRSpeed) div 5);
if Speed<0 then Speed:=0;
PlotSprite(1002, BonRect);
MoveTo(18, 480 - 23);
PenSize(2, 3);
Line(SpeedometerConsts[Speed].h,-SpeedometerConsts[Speed].v);
PenSize(1, 1);
if DoneCount = Wait then
Info^^.Bonus := Info^^.Bonus - 1;
if Info^^.Bonus = 0 then
begin
Dead:=True;
PlaySound(1020);
end;
oldclip:=RaceWindow^.clipRgn;
NewClip:=NewRgn;
SetGWorld(CGrafPtr(RaceWindow),TheScreen);
SetRectRgn(NewClip,0,0,620,480);
RaceWindow^.clipRgn:=NewClip;
if oldscore<>Score then
begin
if (Score div 2000 > oldScore div 2000) and (Score div 2000 > Lastlive) then
begin
Lives:=Lives+1;
Lastlive:=Score div 2000;
PlaySound(1500);
BlinckTick:=TickCount;
end;
NumToString(Score, NumStr);
ShowBgMessage(NumStr, 620 - 65, 480-10, 12,Sb,Sf);
end;
NumToString(Info^^.Bonus, NumStr);
if NumStr[0]<>char(4) then
begin
NumStr[byte(NumStr[0])+1]:=' ';
NumStr[byte(NumStr[0])+2]:=' ';
NumStr[0]:=char(byte(NumStr[0])+2);
end;
ShowBgMessage(NumStr, 620 - 170, 480-10, 12,Sb,Sf);
if (MultiBonus < 0) and (MultiBonus<>oldBonus)then
begin
SetRect(BonRect, 620 - 135, 480-22, 620 - 117, 480-4);
myIcon:=GetCIcon(1040 + abs(multiBonus));
PlotCIcon(BonRect,myIcon);
DisposeCicon(myIcon);
end;
if oldlives<>lives then
begin
NumToString(Lives, NumStr);
ShowBgMessage(NumStr, 620 - 250, 480-10, 12,Sb,Sf);
end;
RaceWindow^.clipRgn:=oldClip;
DisposeRgn(NewClip);
SetGWorld(Screenworld,nil);
oldScore:=Score;
oldLives:=Lives;
oldBonus:=MultiBonus;
end
else
PlotSprite(1003, BonRect);
end;
begin
DispProc;
WaitProc;
DoneProc;
GameOProc;
end;
end.